summaryrefslogtreecommitdiffstats
path: root/generic/tclExecute.c
diff options
context:
space:
mode:
authorMiguel Sofer <miguel.sofer@gmail.com>2001-09-19 11:59:58 (GMT)
committerMiguel Sofer <miguel.sofer@gmail.com>2001-09-19 11:59:58 (GMT)
commit61c95ccf50b02fed3a084cc47fa5b10e3c6e753a (patch)
tree090aa95b176b3d4acdf0e1978e064a3f2c3737a5 /generic/tclExecute.c
parentdabb80c77773a5cd37944e37a8cca2e7f6265835 (diff)
downloadtcl-61c95ccf50b02fed3a084cc47fa5b10e3c6e753a.zip
tcl-61c95ccf50b02fed3a084cc47fa5b10e3c6e753a.tar.gz
tcl-61c95ccf50b02fed3a084cc47fa5b10e3c6e753a.tar.bz2
insured that execution stack errors are also detected at abnormal returns.
Diffstat (limited to 'generic/tclExecute.c')
-rw-r--r--generic/tclExecute.c23
1 files changed, 11 insertions, 12 deletions
diff --git a/generic/tclExecute.c b/generic/tclExecute.c
index e1d143b..226386b 100644
--- a/generic/tclExecute.c
+++ b/generic/tclExecute.c
@@ -10,7 +10,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclExecute.c,v 1.31 2001/09/17 12:29:05 msofer Exp $
+ * RCS: @(#) $Id: tclExecute.c,v 1.32 2001/09/19 11:59:58 msofer Exp $
*/
#include "tclInt.h"
@@ -639,15 +639,7 @@ TclExecuteByteCode(interp, codePtr)
Tcl_SetObjResult(interp, valuePtr);
TclDecrRefCount(valuePtr);
if (stackTop != initStackTop) {
- /*
- * if extra items in the stack, clean up the stack before return
- */
- if (stackTop > initStackTop) goto abnormalReturn;
- fprintf(stderr, "\nTclExecuteByteCode: done instruction at pc %u: stack top %d < entry stack top %d\n",
- (unsigned int)(pc - codePtr->codeStart),
- (unsigned int) stackTop,
- (unsigned int) initStackTop);
- panic("TclExecuteByteCode execution failure: end stack top < start stack top");
+ goto abnormalReturn;
}
TRACE_WITH_OBJ(("=> return code=%d, result=", result),
iPtr->objResultPtr);
@@ -3458,7 +3450,7 @@ TclExecuteByteCode(interp, codePtr)
/*
* Abnormal return code. Restore the stack to state it had when starting
- * to execute the ByteCode.
+ * to execute the ByteCode. Panic if the stack is below the initial level.
*/
abnormalReturn:
@@ -3466,7 +3458,14 @@ TclExecuteByteCode(interp, codePtr)
valuePtr = POP_OBJECT();
Tcl_DecrRefCount(valuePtr);
}
-
+ if (stackTop < initStackTop) {
+ fprintf(stderr, "\nTclExecuteByteCode: abnormal return at pc %u: stack top %d < entry stack top %d\n",
+ (unsigned int)(pc - codePtr->codeStart),
+ (unsigned int) stackTop,
+ (unsigned int) initStackTop);
+ panic("TclExecuteByteCode execution failure: end stack top < start stack top");
+ }
+
/*
* Free the catch stack array if malloc'ed storage was used.
*/