diff options
author | dgp <dgp@users.sourceforge.net> | 2003-09-29 22:03:43 (GMT) |
---|---|---|
committer | dgp <dgp@users.sourceforge.net> | 2003-09-29 22:03:43 (GMT) |
commit | 727cc7ed58601550160c4b3dbc91bec67fec705f (patch) | |
tree | 2317435f500aeefe27f8bf5723cfec0c8f8b64e2 /generic/tclBasic.c | |
parent | d6fa269907f590d521bdbc7aa2c2225f3beb3526 (diff) | |
download | tcl-727cc7ed58601550160c4b3dbc91bec67fec705f.zip tcl-727cc7ed58601550160c4b3dbc91bec67fec705f.tar.gz tcl-727cc7ed58601550160c4b3dbc91bec67fec705f.tar.bz2 |
* generic/tclBasic.c (CallCommandTraces): Added safety bit
* tests/trace.test: masking to prevent any of the bit values
TCL_TRACE_*_EXEC from leaking into the flags field of any
Command struct. This does not fix [Bug 811483] but helps to
contain some of its worst symptoms. Also backported the corrections
to test trace-28.4 from Vince Darley.
Diffstat (limited to 'generic/tclBasic.c')
-rw-r--r-- | generic/tclBasic.c | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/generic/tclBasic.c b/generic/tclBasic.c index 629293f..50f80d4 100644 --- a/generic/tclBasic.c +++ b/generic/tclBasic.c @@ -13,7 +13,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclBasic.c,v 1.75.2.5 2003/07/18 23:35:38 dgp Exp $ + * RCS: @(#) $Id: tclBasic.c,v 1.75.2.6 2003/09/29 22:03:44 dgp Exp $ */ #include "tclInt.h" @@ -2560,6 +2560,9 @@ CallCommandTraces(iPtr, cmdPtr, oldName, newName, flags) ActiveCommandTrace active; char *result; Tcl_Obj *oldNamePtr = NULL; + int mask = (TCL_TRACE_DELETE | TCL_TRACE_RENAME); /* Safety */ + + flags &= mask; if (cmdPtr->flags & CMD_TRACE_ACTIVE) { /* @@ -2595,11 +2598,13 @@ CallCommandTraces(iPtr, cmdPtr, oldName, newName, flags) for (tracePtr = cmdPtr->tracePtr; tracePtr != NULL; tracePtr = active.nextTracePtr) { + int traceFlags = (tracePtr->flags & mask); + active.nextTracePtr = tracePtr->nextPtr; - if (!(tracePtr->flags & flags)) { + if (!(traceFlags & flags)) { continue; } - cmdPtr->flags |= tracePtr->flags; + cmdPtr->flags |= traceFlags; if (oldName == NULL) { TclNewObj(oldNamePtr); Tcl_IncrRefCount(oldNamePtr); @@ -2610,7 +2615,7 @@ CallCommandTraces(iPtr, cmdPtr, oldName, newName, flags) tracePtr->refCount++; (*tracePtr->traceProc)(tracePtr->clientData, (Tcl_Interp *) iPtr, oldName, newName, flags); - cmdPtr->flags &= ~tracePtr->flags; + cmdPtr->flags &= ~traceFlags; if ((--tracePtr->refCount) <= 0) { ckfree((char*)tracePtr); } |