Skip to content

Commit 8b7ebbb

Browse files
miss-islingtonVanshAgarwal24036picnixz
authored
[3.13] gh-143544: Fix possible use-after-free in the JSON decoder when JSONDecodeError disappears during raising it (GH-143561) (#143734)
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 b06ef5b commit 8b7ebbb

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
@@ -308,11 +308,12 @@ raise_errmsg(const char *msg, PyObject *s, Py_ssize_t end)
308308

309309
PyObject *exc;
310310
exc = PyObject_CallFunction(JSONDecodeError, "zOn", msg, s, end);
311-
Py_DECREF(JSONDecodeError);
312311
if (exc) {
313312
PyErr_SetObject(JSONDecodeError, exc);
314313
Py_DECREF(exc);
315314
}
315+
316+
Py_DECREF(JSONDecodeError);
316317
}
317318

318319
static void

0 commit comments

Comments
 (0)