https://github.com/python/cpython/commit/c3157480601499565fd42a8afbdb0207328ac484 commit: c3157480601499565fd42a8afbdb0207328ac484 branch: main author: VanshAgarwal24036 <[email protected]> committer: vstinner <[email protected]> date: 2026-01-12T16:39:32+01:00 summary:
gh-143544: Fix possible use-after-free in the JSON decoder when JSONDecodeError disappears during raising it (#143561) Co-authored-by: Bénédikt Tran <[email protected]> files: M Modules/_json.c diff --git a/Modules/_json.c b/Modules/_json.c index 14714d4b346546..78a85496575a2c 100644 --- a/Modules/_json.c +++ b/Modules/_json.c @@ -423,11 +423,12 @@ raise_errmsg(const char *msg, PyObject *s, Py_ssize_t end) PyObject *exc; exc = PyObject_CallFunction(JSONDecodeError, "zOn", msg, s, end); - Py_DECREF(JSONDecodeError); if (exc) { PyErr_SetObject(JSONDecodeError, exc); Py_DECREF(exc); } + + Py_DECREF(JSONDecodeError); } static void _______________________________________________ Python-checkins mailing list -- [email protected] To unsubscribe send an email to [email protected] https://mail.python.org/mailman3//lists/python-checkins.python.org Member address: [email protected]
