summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMiguel Sofer <miguel.sofer@gmail.com>2010-10-09 15:56:34 (GMT)
committerMiguel Sofer <miguel.sofer@gmail.com>2010-10-09 15:56:34 (GMT)
commit57398d8af9a58f4dbe42fa4a1284442ba9882790 (patch)
tree7040eccd675fe646d87def5ed155b849b31242cb
parentdf3f7a53424e12a05a6816ca12e8436febe5983f (diff)
downloadtcl-57398d8af9a58f4dbe42fa4a1284442ba9882790.zip
tcl-57398d8af9a58f4dbe42fa4a1284442ba9882790.tar.gz
tcl-57398d8af9a58f4dbe42fa4a1284442ba9882790.tar.bz2
* generic/tclExecute.c: fix overallocation of exec stack in TEBC
(mixing numwords and numbytes)
-rw-r--r--ChangeLog5
-rw-r--r--generic/tclExecute.c10
2 files changed, 11 insertions, 4 deletions
diff --git a/ChangeLog b/ChangeLog
index 9c67373..6dcaecb 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2010-10-10 Miguel Sofer <msofer@users.sf.net>
+
+ * generic/tclExecute.c: fix overallocation of exec stack in TEBC
+ (mixing numwords and numbytes)
+
2010-10-08 Jan Nijtmans <nijtmans@users.sf.net>
* generic/tclIOSock.c: On Windows, use gai_strerrorA
diff --git a/generic/tclExecute.c b/generic/tclExecute.c
index 06c0948..649b100 100644
--- a/generic/tclExecute.c
+++ b/generic/tclExecute.c
@@ -14,7 +14,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.504 2010/10/02 12:38:30 dkf Exp $
+ * RCS: @(#) $Id: tclExecute.c,v 1.505 2010/10/09 15:56:35 msofer Exp $
*/
#include "tclInt.h"
@@ -1883,6 +1883,10 @@ TclNRExecuteByteCode(
{
Interp *iPtr = (Interp *) interp;
BottomData *BP;
+ int size = sizeof(BottomData) + sizeof(CmdFrame) +
+ + (codePtr->maxStackDepth + codePtr->maxExceptDepth)
+ *(sizeof(Tcl_Obj *));
+ int numWords = (size + sizeof(Tcl_Obj *) - 1)/sizeof(Tcl_Obj *);
if (iPtr->execEnvPtr->rewind) {
return TCL_ERROR;
@@ -1902,9 +1906,7 @@ TclNRExecuteByteCode(
* execution stack is large enough to execute this ByteCode.
*/
- BP = (BottomData *) GrowEvaluationStack(iPtr->execEnvPtr,
- sizeof(BottomData) + codePtr->maxExceptDepth + sizeof(CmdFrame)
- + codePtr->maxStackDepth, 0);
+ BP = (BottomData *) GrowEvaluationStack(iPtr->execEnvPtr, numWords, 0);
esPtr->tosPtr = initTosPtr;
BP->codePtr = codePtr;