https://github.com/python/cpython/commit/59d97683c19923b06e2b2110efadb90fe37f53f3
commit: 59d97683c19923b06e2b2110efadb90fe37f53f3
branch: main
author: VanshAgarwal24036 <[email protected]>
committer: vstinner <[email protected]>
date: 2026-03-13T13:15:26+01:00
summary:

gh-145792: Fix incorrect alloca allocation size in traceback.c (#145814)

files:
A 
Misc/NEWS.d/next/Core_and_Builtins/2026-03-11-19-09-47.gh-issue-145792.X5KUhc.rst
M 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
index 00000000000000..bd42f32d6ae3f5
--- /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 74360a1c73c271..1e8c9c879f9aac 100644
--- a/Python/traceback.c
+++ b/Python/traceback.c
@@ -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]

_______________________________________________
Python-checkins mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3//lists/python-checkins.python.org
Member address: [email protected]

Reply via email to