summaryrefslogtreecommitdiffstats
path: root/generic
diff options
context:
space:
mode:
authordkf <donal.k.fellows@manchester.ac.uk>2014-05-11 10:39:14 (GMT)
committerdkf <donal.k.fellows@manchester.ac.uk>2014-05-11 10:39:14 (GMT)
commitf779f4219c9a9bdc0c7cd766fbb0e9564936bdd9 (patch)
tree9b3cc8e5f9619ec7ed1b75ffc717e142bd2beff6 /generic
parentf3283e67a3037b34b0a3811bab9e09333c13d8f4 (diff)
downloadtcl-f779f4219c9a9bdc0c7cd766fbb0e9564936bdd9.zip
tcl-f779f4219c9a9bdc0c7cd766fbb0e9564936bdd9.tar.gz
tcl-f779f4219c9a9bdc0c7cd766fbb0e9564936bdd9.tar.bz2
[6d2f249a01] Handle a failure to comprehend half-way through the compilation of a chain of compileable ensembles.
Diffstat (limited to 'generic')
-rw-r--r--generic/tclEnsemble.c24
1 files changed, 17 insertions, 7 deletions
diff --git a/generic/tclEnsemble.c b/generic/tclEnsemble.c
index 9bb7a0c..022dafa 100644
--- a/generic/tclEnsemble.c
+++ b/generic/tclEnsemble.c
@@ -2751,13 +2751,6 @@ TclCompileEnsemble(
const char *word;
Tcl_IncrRefCount(replaced);
-
- /*
- * This is where we return to if we are parsing multiple nested compiled
- * ensembles. [info object] is such a beast.
- */
-
- checkNextWord:
if (parsePtr->numWords < depth + 1) {
goto failed;
}
@@ -2769,6 +2762,12 @@ TclCompileEnsemble(
goto failed;
}
+ /*
+ * This is where we return to if we are parsing multiple nested compiled
+ * ensembles. [info object] is such a beast.
+ */
+
+ checkNextWord:
word = tokenPtr[1].start;
numBytes = tokenPtr[1].size;
@@ -2979,6 +2978,17 @@ TclCompileEnsemble(
if (cmdPtr->compileProc == TclCompileEnsemble) {
tokenPtr = TokenAfter(tokenPtr);
+ if (parsePtr->numWords < depth + 1
+ || tokenPtr->type != TCL_TOKEN_SIMPLE_WORD) {
+ /*
+ * Too hard because the user has done something unpleasant like
+ * omitting the sub-ensemble's command name or used a non-constant
+ * name for a sub-ensemble's command name; we respond by bailing
+ * out completely (this is a rare case). [Bug 6d2f249a01]
+ */
+
+ goto cleanup;
+ }
ensemble = (Tcl_Command) cmdPtr;
goto checkNextWord;
}