From: Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> Date: Fri, 13 Mar 2026 12:45:18 +0000 (+0100) Subject: [3.14] gh-145792: Fix incorrect alloca allocation size in traceback.c (GH-145814... X-Git-Tag: v3.14.4~146 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=d9c26676b26ab09d8db7265dc22a733d3c358d4b;p=thirdparty%2FPython%2Fcpython.git [3.14] gh-145792: Fix incorrect alloca allocation size in traceback.c (GH-145814) (#145909) gh-145792: Fix incorrect alloca allocation size in traceback.c (GH-145814) (cherry picked from commit 59d97683c19923b06e2b2110efadb90fe37f53f3) Co-authored-by: VanshAgarwal24036 <148854295+VanshAgarwal24036@users.noreply.github.com> --- diff --git a/Misc/NEWS.d/next/Core_and_Builtins/2026-03-11-19-09-47.gh-issue-145792.X5KUhc.rst b/Misc/NEWS.d/next/Core_and_Builtins/2026-03-11-19-09-47.gh-issue-145792.X5KUhc.rst new file mode 100644 index 000000000000..bd42f32d6ae3 --- /dev/null +++ b/Misc/NEWS.d/next/Core_and_Builtins/2026-03-11-19-09-47.gh-issue-145792.X5KUhc.rst @@ -0,0 +1,2 @@ +Fix out-of-bounds access when invoking faulthandler on a CPython build +compiled without support for VLAs. diff --git a/Python/traceback.c b/Python/traceback.c index b9c9132c0c50..c8c13d16d4c7 100644 --- a/Python/traceback.c +++ b/Python/traceback.c @@ -42,7 +42,7 @@ #if defined(__STDC_NO_VLA__) && (__STDC_NO_VLA__ == 1) /* Use alloca() for VLAs. */ -# define VLA(type, name, size) type *name = alloca(size) +# define VLA(type, name, size) type *name = alloca(sizeof(type) * (size)) #elif !defined(__STDC_NO_VLA__) || (__STDC_NO_VLA__ == 0) /* Use actual C VLAs.*/ # define VLA(type, name, size) type name[size]