diff options
author | dgp <dgp@users.sourceforge.net> | 2007-06-26 03:12:35 (GMT) |
---|---|---|
committer | dgp <dgp@users.sourceforge.net> | 2007-06-26 03:12:35 (GMT) |
commit | 8584690093094721708f417633f2ef9f0c6c8864 (patch) | |
tree | c3dc99e6b2141aa0374c44204c33fae6d4afff51 | |
parent | 3136efdb1c9f457809489f244bc836768099d6d6 (diff) | |
download | tcl-8584690093094721708f417633f2ef9f0c6c8864.zip tcl-8584690093094721708f417633f2ef9f0c6c8864.tar.gz tcl-8584690093094721708f417633f2ef9f0c6c8864.tar.bz2 |
* generic/tclExecute.c: Safety checks to avoid crashes in the
TclStack* routines when called with an incompletely initialized
interp. [Bug 1743302]
-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; |