diff options
author | dgp <dgp@users.sourceforge.net> | 2012-09-06 19:01:32 (GMT) |
---|---|---|
committer | dgp <dgp@users.sourceforge.net> | 2012-09-06 19:01:32 (GMT) |
commit | dcb740cc8314b235fd1b2d6275ace3194510ffc0 (patch) | |
tree | 144b06b527e0bc0ae8420df93c1482f918544578 /generic | |
parent | 5c94189d521507337dc7831ceae34212fadf771b (diff) | |
download | tcl-dcb740cc8314b235fd1b2d6275ace3194510ffc0.zip tcl-dcb740cc8314b235fd1b2d6275ace3194510ffc0.tar.gz tcl-dcb740cc8314b235fd1b2d6275ace3194510ffc0.tar.bz2 |
3564735 Protection against namespace var resolvers that unexpectedly return
a pointer to Var while Tcl expects pointer to VarInHash. This may not be
the total solution to Bug 3564735 (Itcl may be misbehaving), but this will
prevent memory corruption.
Diffstat (limited to 'generic')
-rw-r--r-- | generic/tclInt.h | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/generic/tclInt.h b/generic/tclInt.h index e1ce6d5..cca9938 100644 --- a/generic/tclInt.h +++ b/generic/tclInt.h @@ -693,13 +693,17 @@ typedef struct VarInHash { #define TclSetVarNamespaceVar(varPtr) \ if (!TclIsVarNamespaceVar(varPtr)) {\ (varPtr)->flags |= VAR_NAMESPACE_VAR;\ - ((VarInHash *)(varPtr))->refCount++;\ + if (TclIsVarInHash(varPtr)) {\ + ((VarInHash *)(varPtr))->refCount++;\ + }\ } #define TclClearVarNamespaceVar(varPtr) \ if (TclIsVarNamespaceVar(varPtr)) {\ (varPtr)->flags &= ~VAR_NAMESPACE_VAR;\ - ((VarInHash *)(varPtr))->refCount--;\ + if (TclIsVarInHash(varPtr)) {\ + ((VarInHash *)(varPtr))->refCount--;\ + }\ } /* |