mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-05-23 13:52:28 +00:00
Remove undefined behaviors
This commit is contained in:
parent
4864565198
commit
b3838173ec
51 changed files with 756 additions and 1302 deletions
|
@ -103,10 +103,14 @@ void OnFpe(int sig, struct siginfo *si, struct ucontext *ctx) {
|
|||
ctx->uc_mcontext.rdx = 0;
|
||||
}
|
||||
|
||||
TEST(sigaction, sigFpe_handlerCanEditProcessStateAndRecoverExecution) {
|
||||
noubsan void ubsanTrumpsSystemsEngineering(void) {
|
||||
struct sigaction saint = {.sa_sigaction = OnFpe, .sa_flags = SA_SIGINFO};
|
||||
EXPECT_NE(-1, sigaction(SIGFPE, &saint, &oldsa));
|
||||
volatile long x = 0;
|
||||
EXPECT_EQ(42, 666 / x); /* systems engineering trumps math */
|
||||
EXPECT_NE(-1, sigaction(SIGFPE, &oldsa, NULL));
|
||||
}
|
||||
|
||||
TEST(sigaction, sigFpe_handlerCanEditProcessStateAndRecoverExecution) {
|
||||
ubsanTrumpsSystemsEngineering();
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue