Skip to content

Instantly share code, notes, and snippets.

@scottt
Last active February 26, 2023 13:05
Show Gist options
  • Save scottt/d48eb2ae14e271a49de6 to your computer and use it in GitHub Desktop.
Save scottt/d48eb2ae14e271a49de6 to your computer and use it in GitHub Desktop.
Generate SIGFPE through integer division by zero
volatile int a, b, out;
__attribute__((noclone,noinline))
void g(void)
{
a = -1;
b = 0;
out = a/b;
}
__attribute__((noclone,noinline))
void f(void)
{
g();
}
int main()
{
f();
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment