diff options
author | Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com> | 2023-03-08 07:59:39 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-03-08 07:59:39 (GMT) |
commit | 1a84cc007e207f2dd61f86a7fc3d86632fdce72f (patch) | |
tree | 9304ca9358fe51e85ecbcb7b010d132e4e9c1450 /Modules | |
parent | 061325e0d2bbec6ff89d03f527c91dc7bfa14003 (diff) | |
download | cpython-1a84cc007e207f2dd61f86a7fc3d86632fdce72f.zip cpython-1a84cc007e207f2dd61f86a7fc3d86632fdce72f.tar.gz cpython-1a84cc007e207f2dd61f86a7fc3d86632fdce72f.tar.bz2 |
GH-102397: Fix segfault from race condition in signal handling (#102399)
Co-authored-by: Gregory P. Smith <greg@krypto.org>
Diffstat (limited to 'Modules')
-rw-r--r-- | Modules/signalmodule.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/Modules/signalmodule.c b/Modules/signalmodule.c index cd26eca..0e472e1 100644 --- a/Modules/signalmodule.c +++ b/Modules/signalmodule.c @@ -148,6 +148,10 @@ get_signal_state(PyObject *module) static inline int compare_handler(PyObject *func, PyObject *dfl_ign_handler) { + // See https://github.com/python/cpython/pull/102399 + if (func == NULL || dfl_ign_handler == NULL) { + return 0; + } assert(PyLong_CheckExact(dfl_ign_handler)); if (!PyLong_CheckExact(func)) { return 0; |