diff options
-rw-r--r-- | ChangeLog | 6 | ||||
-rw-r--r-- | generic/tclExecute.c | 15 |
2 files changed, 13 insertions, 8 deletions
@@ -1,3 +1,9 @@ +2007-06-25 Don Porter <dgp@users.sourceforge.net> + + * generic/tclExecute.c: Safety checks to avoid crashes in the + TclStack* routines when called with an incompletely initialized + interp. [Bug 1743302] + 2007-06-25 Miguel Sofer <msofer@users.sf.net> * generic/tclVar.c (UnsetVarStruct): fixing incomplete change, diff --git a/generic/tclExecute.c b/generic/tclExecute.c index d51c8fd..56981be 100644 --- a/generic/tclExecute.c +++ b/generic/tclExecute.c @@ -12,7 +12,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.303 2007/06/22 17:09:17 dgp Exp $ + * RCS: @(#) $Id: tclExecute.c,v 1.304 2007/06/26 03:12:35 dgp Exp $ */ #include "tclInt.h" @@ -815,12 +815,12 @@ TclStackFree( Tcl_Interp *interp, void *freePtr) { - Interp *iPtr; + Interp *iPtr = (Interp *) interp; ExecEnv *eePtr; ExecStack *esPtr; Tcl_Obj **markerPtr; - if (interp == NULL) { + if (iPtr == NULL || iPtr->execEnvPtr == NULL) { Tcl_Free((char *) freePtr); return; } @@ -831,7 +831,6 @@ TclStackFree( * the previous marker. */ - iPtr = (Interp *) interp; eePtr = iPtr->execEnvPtr; esPtr = eePtr->execStackPtr; markerPtr = esPtr->markerPtr; @@ -867,9 +866,10 @@ TclStackAlloc( Tcl_Interp *interp, int numBytes) { + Interp *iPtr = (Interp *) interp; int numWords = (numBytes + (sizeof(Tcl_Obj *) - 1))/sizeof(Tcl_Obj *); - if (interp == NULL) { + if (iPtr == NULL || iPtr->execEnvPtr == NULL) { return (void *) Tcl_Alloc(numBytes); } @@ -882,17 +882,16 @@ TclStackRealloc( void *ptr, int numBytes) { - Interp *iPtr; + Interp *iPtr = (Interp *) interp; ExecEnv *eePtr; ExecStack *esPtr; Tcl_Obj **markerPtr; int numWords; - if (interp == NULL) { + if (iPtr == NULL || iPtr->execEnvPtr == NULL) { return (void *) Tcl_Realloc((char *) ptr, numBytes); } - iPtr = (Interp *) interp; eePtr = iPtr->execEnvPtr; esPtr = eePtr->execStackPtr; markerPtr = esPtr->markerPtr; |