diff options
author | Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> | 2023-03-08 08:21:13 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-03-08 08:21:13 (GMT) |
commit | c4fb41816f6045dd608d4d97266f16feaf974b83 (patch) | |
tree | b5cfbe4d807abebe2ab7f87457b2f2d5c3ce4a4b /Modules/signalmodule.c | |
parent | 5e6351c1fb193b742e8d05bbf2135c318ff8bb65 (diff) | |
download | cpython-c4fb41816f6045dd608d4d97266f16feaf974b83.zip cpython-c4fb41816f6045dd608d4d97266f16feaf974b83.tar.gz cpython-c4fb41816f6045dd608d4d97266f16feaf974b83.tar.bz2 |
[3.10] GH-102397: Fix segfault from race condition in signal handling (GH-102399) (#102527)
GH-102397: Fix segfault from race condition in signal handling (GH-102399)
(cherry picked from commit 1a84cc007e207f2dd61f86a7fc3d86632fdce72f)
Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
Co-authored-by: Gregory P. Smith <greg@krypto.org>
Diffstat (limited to 'Modules/signalmodule.c')
-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 80fa4d5..bcfd553 100644 --- a/Modules/signalmodule.c +++ b/Modules/signalmodule.c @@ -177,6 +177,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; |