diff options
author | dkf <donal.k.fellows@manchester.ac.uk> | 2013-01-04 14:38:37 (GMT) |
---|---|---|
committer | dkf <donal.k.fellows@manchester.ac.uk> | 2013-01-04 14:38:37 (GMT) |
commit | 18d9d66f4d3a6a8b468474e25d5bacee500bda85 (patch) | |
tree | 709b0fa2e8d57aef2948a721b619752b157d6a4b | |
parent | 09d1473b3be04898d6ec67abcad0b980fdd88df6 (diff) | |
download | tcl-18d9d66f4d3a6a8b468474e25d5bacee500bda85.zip tcl-18d9d66f4d3a6a8b468474e25d5bacee500bda85.tar.gz tcl-18d9d66f4d3a6a8b468474e25d5bacee500bda85.tar.bz2 |
Fix bad memory access problems found by Miguel Sofer when valgrinding.
-rw-r--r-- | generic/tclCompCmdsSZ.c | 2 | ||||
-rw-r--r-- | generic/tclEnsemble.c | 13 |
2 files changed, 10 insertions, 5 deletions
diff --git a/generic/tclCompCmdsSZ.c b/generic/tclCompCmdsSZ.c index 7bead0d..1d04d8b 100644 --- a/generic/tclCompCmdsSZ.c +++ b/generic/tclCompCmdsSZ.c @@ -2737,7 +2737,7 @@ TclCompileUnsetCmd( flags = 1; varTokenPtr = TokenAfter(parsePtr->tokenPtr); leadingWord = Tcl_NewObj(); - if (TclWordKnownAtCompileTime(varTokenPtr, leadingWord)) { + if (numWords > 0 && TclWordKnownAtCompileTime(varTokenPtr, leadingWord)) { int len; const char *bytes = Tcl_GetStringFromObj(leadingWord, &len); diff --git a/generic/tclEnsemble.c b/generic/tclEnsemble.c index 4e2a5cd..9a2d598 100644 --- a/generic/tclEnsemble.c +++ b/generic/tclEnsemble.c @@ -2956,9 +2956,14 @@ TclCompileEnsemble( Tcl_ListObjAppendElement(NULL, replaced, replacement); if (Tcl_ListObjGetElements(NULL, targetCmdObj, &len, &elems) != TCL_OK) { goto failed; - } - if (len != 1) { - goto failed; + } else if (len != 1) { + /* + * Note that at this point we know we can't issue any special + * instruction sequence as the mapping isn't one that we support at + * the compiled level. + */ + + goto cleanup; } targetCmdObj = elems[0]; @@ -3011,7 +3016,7 @@ TclCompileEnsemble( */ failed: - if (len == 1 && depth < 250) { + if (depth < 250) { if (depth > 1) { if (!invokeAnyway) { cmdPtr = oldCmdPtr; |