gh-145792: Fix incorrect alloca allocation size in traceback.c (#145814) · python/cpython@59d9768

GitHub

File tree

Misc/NEWS.d/next/Core_and_Builtins

Python

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.

Original file line numberDiff line numberDiff line change@@ -41,7 +41,7 @@

41414242#if defined(__STDC_NO_VLA__) && (__STDC_NO_VLA__==1)

4343/* Use alloca() for VLAs. */

44-# defineVLA(type, name, size) type *name = alloca(size)

44+# defineVLA(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# defineVLA(type, name, size) type name[size]