summaryrefslogtreecommitdiffstats
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
parentdabb80c77773a5cd37944e37a8cca2e7f6265835 (diff)
downloadtcl-61c95ccf50b02fed3a084cc47fa5b10e3c6e753a.zip
tcl-61c95ccf50b02fed3a084cc47fa5b10e3c6e753a.tar.gz
tcl-61c95ccf50b02fed3a084cc47fa5b10e3c6e753a.tar.bz2
insured that execution stack errors are also detected at abnormal returns.
-rw-r--r--ChangeLog5
-rw-r--r--generic/tclExecute.c23
2 files changed, 16 insertions, 12 deletions
diff --git a/ChangeLog b/ChangeLog
index f11e877..db018b1 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2001-09-19 Miguel Sofer <msofer@users.sourceforge.net>
+
+ * generic/tclExecute.c: insured that execution stack errors are
+ also detected at abnormal returns.
+
2001-09-19 Donal K. Fellows <fellowsd@cs.man.ac.uk>
* doc/socket.n: Added documentation to mention what happens when a
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.
*/