diff options
author | Miguel Sofer <miguel.sofer@gmail.com> | 2008-07-29 13:45:08 (GMT) |
---|---|---|
committer | Miguel Sofer <miguel.sofer@gmail.com> | 2008-07-29 13:45:08 (GMT) |
commit | d63487fc10c65ca57db9496dc4300e63faece5fa (patch) | |
tree | 6bb30553faa6e9251277cfc747c9717c45d57814 /generic/tclExecute.c | |
parent | cb577f757e0f2461f6e4886506c1899ae34b3d98 (diff) | |
download | tcl-d63487fc10c65ca57db9496dc4300e63faece5fa.zip tcl-d63487fc10c65ca57db9496dc4300e63faece5fa.tar.gz tcl-d63487fc10c65ca57db9496dc4300e63faece5fa.tar.bz2 |
* generic/tclExecute.c: fix [Bug 2030670] that cause
TclStackRealloc to panic on rare corner cases. Thx ajpasadyn for
diagnose and patch.
Diffstat (limited to 'generic/tclExecute.c')
-rw-r--r-- | generic/tclExecute.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/generic/tclExecute.c b/generic/tclExecute.c index 0aee386..0965d48 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.388 2008/07/29 05:30:26 msofer Exp $ + * RCS: @(#) $Id: tclExecute.c,v 1.389 2008/07/29 13:45:17 msofer Exp $ */ #include "tclInt.h" @@ -973,6 +973,7 @@ GrowEvaluationStack( int newBytes, newElems, currElems; int needed = growth - (esPtr->endPtr - esPtr->tosPtr); Tcl_Obj **markerPtr = esPtr->markerPtr, **memStart; + int moveWords = 0; if (move) { if (!markerPtr) { @@ -1007,9 +1008,9 @@ GrowEvaluationStack( */ if (move) { - move = esPtr->tosPtr - MEMSTART(markerPtr) + 1; + moveWords = esPtr->tosPtr - MEMSTART(markerPtr) + 1; } - needed = growth + move + WALLOCALIGN - 1; + needed = growth + moveWords + WALLOCALIGN - 1; /* * Check if there is enough room in the next stack (if there is one, it @@ -1069,8 +1070,8 @@ GrowEvaluationStack( esPtr->tosPtr = memStart - 1; if (move) { - memcpy(memStart, MEMSTART(markerPtr), move*sizeof(Tcl_Obj *)); - esPtr->tosPtr += move; + memcpy(memStart, MEMSTART(markerPtr), moveWords*sizeof(Tcl_Obj *)); + esPtr->tosPtr += moveWords; oldPtr->markerPtr = (Tcl_Obj **) *markerPtr; oldPtr->tosPtr = markerPtr-1; } |