diff options
author | dgp <dgp@noemail.net> | 2003-09-29 22:03:42 (GMT) |
---|---|---|
committer | dgp <dgp@noemail.net> | 2003-09-29 22:03:42 (GMT) |
commit | f2e4807f481fdb1d9d6051c648ebc06242e30718 (patch) | |
tree | 2317435f500aeefe27f8bf5723cfec0c8f8b64e2 /generic/tclBasic.c | |
parent | 6e5008d7f6972036e737ac8251acf6cbc22f0686 (diff) | |
download | tcl-f2e4807f481fdb1d9d6051c648ebc06242e30718.zip tcl-f2e4807f481fdb1d9d6051c648ebc06242e30718.tar.gz tcl-f2e4807f481fdb1d9d6051c648ebc06242e30718.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.
FossilOrigin-Name: 3592877a846a392416a27dd9fd55b8ac17e3f420
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); } |