]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-145792: Fix incorrect alloca allocation size in traceback.c (#145814)
authorVanshAgarwal24036 <148854295+VanshAgarwal24036@users.noreply.github.com>
Fri, 13 Mar 2026 12:15:26 +0000 (17:45 +0530)
committerGitHub <noreply@github.com>
Fri, 13 Mar 2026 12:15:26 +0000 (13:15 +0100)
Misc/NEWS.d/next/Core_and_Builtins/2026-03-11-19-09-47.gh-issue-145792.X5KUhc.rst [new file with mode: 0644]
Python/traceback.c

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 (file)
index 0000000..bd42f32
--- /dev/null
@@ -0,0 +1,2 @@
+Fix out-of-bounds access when invoking faulthandler on a CPython build
+compiled without support for VLAs.
index 74360a1c73c2713858a40ff5af81e24b08f2179c..1e8c9c879f9aac29c82a214e68a40e784ad15ea6 100644 (file)
@@ -41,7 +41,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]