Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 1436815

Browse files
committed
For debug build, check that the stack pointer never exceeds the stack size.
1 parent 93a569d commit 1436815

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

Python/ceval.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -542,7 +542,9 @@ eval_frame(PyFrameObject *f)
542542
#define BASIC_POP() (*--stack_pointer)
543543

544544
#ifdef LLTRACE
545-
#define PUSH(v) (void)(BASIC_PUSH(v), lltrace && prtrace(TOP(), "push"))
545+
#define PUSH(v) { (void)(BASIC_PUSH(v), \
546+
lltrace && prtrace(TOP(), "push")); \
547+
assert(STACK_LEVEL() <= f->f_stacksize); }
546548
#define POP() ((void)(lltrace && prtrace(TOP(), "pop")), BASIC_POP())
547549
#else
548550
#define PUSH(v) BASIC_PUSH(v)

0 commit comments

Comments
 (0)