Skip to content

Commit 78ea9eb

Browse files
miss-islingtonVanshAgarwal24036picnixz
authored
[3.14] gh-143544: Fix possible use-after-free in the JSON decoder when JSONDecodeError disappears during raising it (GH-143561) (#143733)
gh-143544: Fix possible use-after-free in the JSON decoder when JSONDecodeError disappears during raising it (GH-143561) (cherry picked from commit c315748) Co-authored-by: VanshAgarwal24036 <148854295+VanshAgarwal24036@users.noreply.github.com> Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
1 parent deb75a5 commit 78ea9eb

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

Modules/_json.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -316,11 +316,12 @@ raise_errmsg(const char *msg, PyObject *s, Py_ssize_t end)
316316

317317
PyObject *exc;
318318
exc = PyObject_CallFunction(JSONDecodeError, "zOn", msg, s, end);
319-
Py_DECREF(JSONDecodeError);
320319
if (exc) {
321320
PyErr_SetObject(JSONDecodeError, exc);
322321
Py_DECREF(exc);
323322
}
323+
324+
Py_DECREF(JSONDecodeError);
324325
}
325326

326327
static void

0 commit comments

Comments
 (0)