Skip to content

Commit 59d9768

Browse files
gh-145792: Fix incorrect alloca allocation size in traceback.c (#145814)
1 parent 0b6a234 commit 59d9768

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Fix out-of-bounds access when invoking faulthandler on a CPython build
2+
compiled without support for VLAs.

Python/traceback.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141

4242
#if defined(__STDC_NO_VLA__) && (__STDC_NO_VLA__ == 1)
4343
/* Use alloca() for VLAs. */
44-
# define VLA(type, name, size) type *name = alloca(size)
44+
# define VLA(type, name, size) type *name = alloca(sizeof(type) * (size))
4545
#elif !defined(__STDC_NO_VLA__) || (__STDC_NO_VLA__ == 0)
4646
/* Use actual C VLAs.*/
4747
# define VLA(type, name, size) type name[size]

0 commit comments

Comments
 (0)