From c3972f2795bf9270008d09dc6919b9735e20c606 Mon Sep 17 00:00:00 2001 From: Wulian233 <1055917385@qq.com> Date: Mon, 4 May 2026 21:42:02 +0800 Subject: [PATCH] gh-148418: Fix a possible reference leak in a corrupted TYPE_CODE marshal stream (GH-148419) --- .../2026-04-12-10-40-57.gh-issue-148418.ggA1LZ.rst | 1 + Python/marshal.c | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) create mode 100644 Misc/NEWS.d/next/Core_and_Builtins/2026-04-12-10-40-57.gh-issue-148418.ggA1LZ.rst diff --git a/Misc/NEWS.d/next/Core_and_Builtins/2026-04-12-10-40-57.gh-issue-148418.ggA1LZ.rst b/Misc/NEWS.d/next/Core_and_Builtins/2026-04-12-10-40-57.gh-issue-148418.ggA1LZ.rst new file mode 100644 index 000000000000..793858be7814 --- /dev/null +++ b/Misc/NEWS.d/next/Core_and_Builtins/2026-04-12-10-40-57.gh-issue-148418.ggA1LZ.rst @@ -0,0 +1 @@ +Fix a possible reference leak in a corrupted ``TYPE_CODE`` marshal stream. diff --git a/Python/marshal.c b/Python/marshal.c index dace22da0d4a..990afefe0d3b 100644 --- a/Python/marshal.c +++ b/Python/marshal.c @@ -1636,7 +1636,7 @@ r_object(RFILE *p) goto code_error; firstlineno = (int)r_long(p); if (firstlineno == -1 && PyErr_Occurred()) - break; + goto code_error; linetable = r_object(p); if (linetable == NULL) goto code_error; -- 2.47.3