[Python-checkins] CVS: python/dist/src/Python ceval.c,2.238.2.4,2.238.2.5

Jeremy Hylton jhylton@users.sourceforge.net
2001年12月19日 18:07:38 -0800


Update of /cvsroot/python/python/dist/src/Python
In directory usw-pr-cvs1:/tmp/cvs-serv4024
Modified Files:
 Tag: release21-maint
	ceval.c 
Log Message:
Backport rev 2.301 to the 2.1 maintenance branch.
Add checks for stack underflow and overflow.
Index: ceval.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Python/ceval.c,v
retrieving revision 2.238.2.4
retrieving revision 2.238.2.5
diff -C2 -d -r2.238.2.4 -r2.238.2.5
*** ceval.c	2001年11月21日 04:49:19	2.238.2.4
--- ceval.c	2001年12月20日 02:07:36	2.238.2.5
***************
*** 403,407 ****
 
 #ifdef LLTRACE
! #define PUSH(v)		(BASIC_PUSH(v), lltrace && prtrace(TOP(), "push"))
 #define POP()		(lltrace && prtrace(TOP(), "pop"), BASIC_POP())
 #else
--- 403,409 ----
 
 #ifdef LLTRACE
! #define PUSH(v)		{ (void)(BASIC_PUSH(v), \
! lltrace && prtrace(TOP(), "push")); \
! assert(STACK_LEVEL() <= f->f_stacksize); }
 #define POP()		(lltrace && prtrace(TOP(), "pop"), BASIC_POP())
 #else
***************
*** 682,685 ****
--- 684,689 ----
 
 	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

AltStyle によって変換されたページ (->オリジナル) /