[Python-checkins] CVS: python/dist/src/Python ceval.c,2.300,2.301
Tim Peters
tim_one@users.sourceforge.net
Tue, 18 Dec 2001 20:11:10 -0800
Update of /cvsroot/python/python/dist/src/Python
In directory usw-pr-cvs1:/tmp/cvs-serv24281/python/Python
Modified Files:
ceval.c
Log Message:
SF bug #494668: PUSH() should assert-fail on overflow.
eval_frame(): Added asserts to the top of the eval loop, to verify
that the eval stack pointer is in bounds, plus some comments.
Index: ceval.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Python/ceval.c,v
retrieving revision 2.300
retrieving revision 2.301
diff -C2 -d -r2.300 -r2.301
*** ceval.c 2001/12/18 22:36:40 2.300
--- ceval.c 2001/12/19 04:11:07 2.301
***************
*** 498,502 ****
int lastopcode = 0;
#endif
! PyObject **stack_pointer;
register unsigned char *next_instr;
register int opcode=0; /* Current opcode */
--- 498,502 ----
int lastopcode = 0;
#endif
! PyObject **stack_pointer; /* Next free slot in value stack */
register unsigned char *next_instr;
register int opcode=0; /* Current opcode */
***************
*** 587,591 ****
stack_pointer = f->f_stacktop;
assert(stack_pointer != NULL);
! f->f_stacktop = NULL;
if (tstate->use_tracing) {
--- 587,591 ----
stack_pointer = f->f_stacktop;
assert(stack_pointer != NULL);
! f->f_stacktop = NULL; /* remains NULL unless yield suspends frame */
if (tstate->use_tracing) {
***************
*** 635,638 ****
--- 635,640 ----
for (;;) {
+ assert(stack_pointer >= f->f_valuestack); /* else underflow */
+ assert(STACK_LEVEL() <= f->f_stacksize); /* else overflow */
/* Do periodic things. Doing this every time through
the loop would add too much overhead, so we do it