summaryrefslogtreecommitdiffstats
path: root/generic/tclCompCmds.c
diff options
context:
space:
mode:
authordkf <donal.k.fellows@manchester.ac.uk>2007-03-01 10:07:10 (GMT)
committerdkf <donal.k.fellows@manchester.ac.uk>2007-03-01 10:07:10 (GMT)
commit22f742915ff117cd9e6476f7eed7b10d7fd383fa (patch)
treee716e48dda77030afb205440f1921b448faf9bbc /generic/tclCompCmds.c
parent37e755f3bdebeec9cd0638dbe563de70d6a47426 (diff)
downloadtcl-22f742915ff117cd9e6476f7eed7b10d7fd383fa.zip
tcl-22f742915ff117cd9e6476f7eed7b10d7fd383fa.tar.gz
tcl-22f742915ff117cd9e6476f7eed7b10d7fd383fa.tar.bz2
Fix [Bug 1671138]
Diffstat (limited to 'generic/tclCompCmds.c')
-rw-r--r--generic/tclCompCmds.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/generic/tclCompCmds.c b/generic/tclCompCmds.c
index 6453012..c0721fa 100644
--- a/generic/tclCompCmds.c
+++ b/generic/tclCompCmds.c
@@ -12,7 +12,7 @@
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclCompCmds.c,v 1.100 2007/02/27 21:44:29 dkf Exp $
+ * RCS: @(#) $Id: tclCompCmds.c,v 1.101 2007/03/01 10:07:12 dkf Exp $
*/
#include "tclInt.h"
@@ -1397,8 +1397,21 @@ TclCompileForeachCmd(
goto done;
}
numVars = varcList[loopIndex];
+
+ /*
+ * If the variable list is empty, we can enter an infinite loop when
+ * the interpreted version would not. Take care to ensure this does
+ * not happen. [Bug 1671138]
+ */
+
+ if (numVars == 0) {
+ code = TCL_ERROR;
+ goto done;
+ }
+
for (j = 0; j < numVars; j++) {
const char *varName = varvList[loopIndex][j];
+
if (!TclIsLocalScalar(varName, (int) strlen(varName))) {
code = TCL_ERROR;
goto done;