diff options
author | dgp <dgp@users.sourceforge.net> | 2012-09-11 14:07:27 (GMT) |
---|---|---|
committer | dgp <dgp@users.sourceforge.net> | 2012-09-11 14:07:27 (GMT) |
commit | 3110959c6f9095d249c2991f9f41fb27fa900c1a (patch) | |
tree | 62db53fb3029b4fbf6c6a9f4bb33dfd6ad2696fc /generic/tclInt.h | |
parent | df2aa14a4b12e5a43e8e757268e95e153cc31fdb (diff) | |
download | tcl-3110959c6f9095d249c2991f9f41fb27fa900c1a.zip tcl-3110959c6f9095d249c2991f9f41fb27fa900c1a.tar.gz tcl-3110959c6f9095d249c2991f9f41fb27fa900c1a.tar.bz2 |
3564735 Protect against mem corruption when var resolvers misbehave.
Diffstat (limited to 'generic/tclInt.h')
-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 53a88d6..6c6e664 100644 --- a/generic/tclInt.h +++ b/generic/tclInt.h @@ -801,13 +801,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--;\ + }\ } /* |