Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 5 additions & 16 deletions Modules/faulthandler.c
Original file line number Diff line number Diff line change
Expand Up @@ -1069,8 +1069,8 @@ faulthandler_suppress_crash_report(void)
#endif
}

static PyObject* _Py_NO_SANITIZE_UNDEFINED
faulthandler_read_null(PyObject *self, PyObject *args)
static PyObject*
faulthandler_read_null(PyObject *self, PyObject *Py_UNUSED(args))
{
volatile int *x;
volatile int y;
Expand All @@ -1079,7 +1079,6 @@ faulthandler_read_null(PyObject *self, PyObject *args)
x = NULL;
y = *x;
return PyLong_FromLong(y);

}

static void
Expand Down Expand Up @@ -1158,23 +1157,13 @@ faulthandler_fatal_error_c_thread(PyObject *self, PyObject *args)
Py_RETURN_NONE;
}

static PyObject* _Py_NO_SANITIZE_UNDEFINED
static PyObject*
faulthandler_sigfpe(PyObject *self, PyObject *Py_UNUSED(dummy))
{
faulthandler_suppress_crash_report();

/* Do an integer division by zero: raise a SIGFPE on Intel CPU, but not on
PowerPC. Use volatile to disable compile-time optimizations. */
volatile int x = 1, y = 0, z;
z = x / y;

/* If the division by zero didn't raise a SIGFPE (e.g. on PowerPC),
raise it manually. */
/* raise SIGFPE manually to prevent crafted undefined behaviors */
raise(SIGFPE);

/* This line is never reached, but we pretend to make something with z
to silence a compiler warning. */
return PyLong_FromLong(z);
Py_UNREACHABLE();
}

static PyObject *
Expand Down
Loading