From 40c65a324bee569e51fa4d3c621578d9b18dda7f Mon Sep 17 00:00:00 2001 From: "Gregory P. Smith [Google LLC]" Date: Wed, 13 Apr 2022 00:46:34 +0000 Subject: [PATCH 1/3] Fix an uninitialized bool in exception print context. `struct exception_print_context.need_close` was uninitialized. Found by oss-fuzz in a test case running under the undefined behavior sanitizer. https://oss-fuzz.com/testcase-detail/6217746058182656 ``` Python/pythonrun.c:1241:28: runtime error: load of value 253, which is not a valid value for type 'bool' #0 0xbf2203 in print_chained cpython3/Python/pythonrun.c:1241:28 #1 0xbea4bb in print_exception_cause_and_context cpython3/Python/pythonrun.c:1320:19 #2 0xbea4bb in print_exception_recursive cpython3/Python/pythonrun.c:1470:13 #3 0xbe9e39 in _PyErr_Display cpython3/Python/pythonrun.c:1517:9 ``` Pretty obvious what the ommission was upon code inspection. --- Python/pythonrun.c | 1 + 1 file changed, 1 insertion(+) diff --git a/Python/pythonrun.c b/Python/pythonrun.c index d117b790dfdaae..e086f0f345c222 100644 --- a/Python/pythonrun.c +++ b/Python/pythonrun.c @@ -1504,6 +1504,7 @@ _PyErr_Display(PyObject *file, PyObject *exception, PyObject *value, PyObject *t struct exception_print_context ctx; ctx.file = file; ctx.exception_group_depth = 0; + ctx.need_close = false; ctx.max_group_width = PyErr_MAX_GROUP_WIDTH; ctx.max_group_depth = PyErr_MAX_GROUP_DEPTH; From a012f402c23b24cea3b7f58e35f7572ac3c361fa Mon Sep 17 00:00:00 2001 From: "Gregory P. Smith [Google LLC]" Date: Wed, 13 Apr 2022 00:45:52 +0000 Subject: [PATCH 2/3] Add a NEWS entry. --- .../2022-04-11-18-44-19.gh-issue-89455.d0qMYd.rst | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 Misc/NEWS.d/next/Core and Builtins/2022-04-11-18-44-19.gh-issue-89455.d0qMYd.rst diff --git a/Misc/NEWS.d/next/Core and Builtins/2022-04-11-18-44-19.gh-issue-89455.d0qMYd.rst b/Misc/NEWS.d/next/Core and Builtins/2022-04-11-18-44-19.gh-issue-89455.d0qMYd.rst new file mode 100644 index 00000000000000..72f0176f28586f --- /dev/null +++ b/Misc/NEWS.d/next/Core and Builtins/2022-04-11-18-44-19.gh-issue-89455.d0qMYd.rst @@ -0,0 +1,2 @@ +Fixed an uninitialized bool value in the traceback printing code path that +was introduced by the initial bpo-45292 work. From 6a19b93d78670c19fe5ce55c53df3b8fce75e177 Mon Sep 17 00:00:00 2001 From: "Gregory P. Smith [Google LLC]" Date: Wed, 13 Apr 2022 00:50:27 +0000 Subject: [PATCH 3/3] update news wording. also see if a new commit re-triggers the CLA checker. --- .../2022-04-11-18-44-19.gh-issue-89455.d0qMYd.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Misc/NEWS.d/next/Core and Builtins/2022-04-11-18-44-19.gh-issue-89455.d0qMYd.rst b/Misc/NEWS.d/next/Core and Builtins/2022-04-11-18-44-19.gh-issue-89455.d0qMYd.rst index 72f0176f28586f..e22b4ac44c096c 100644 --- a/Misc/NEWS.d/next/Core and Builtins/2022-04-11-18-44-19.gh-issue-89455.d0qMYd.rst +++ b/Misc/NEWS.d/next/Core and Builtins/2022-04-11-18-44-19.gh-issue-89455.d0qMYd.rst @@ -1,2 +1,2 @@ Fixed an uninitialized bool value in the traceback printing code path that -was introduced by the initial bpo-45292 work. +was introduced by the initial bpo-45292 exception groups work.