From aea8306abb880c9d2d7e31089e92348b137e4935 Mon Sep 17 00:00:00 2001 From: stanton Date: Tue, 6 Oct 1998 21:24:23 +0000 Subject: 8.1a2 bug: The compile procedure for "if" incorrectly attempted to match against the literal string "if", resulting in a stack overflow when "::if" was compiled. It also would incorrectly accept "if" instead of "elsif" in later clauses. --- changes | 7 ++++++- generic/tclCompCmds.c | 4 ++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/changes b/changes index 0f2891c..f41914d 100644 --- a/changes +++ b/changes @@ -1,6 +1,6 @@ Recent user-visible changes to Tcl: -RCS: @(#) $Id: changes,v 1.1.2.4 1998/10/06 02:59:03 stanton Exp $ +RCS: @(#) $Id: changes,v 1.1.2.5 1998/10/06 21:24:23 stanton Exp $ 1. No more [command1] [command2] construct for grouping multiple commands on a single command line. @@ -3912,3 +3912,8 @@ as starvation of the notifier thread. (BW) 9/22/98 (bug fix) Changed the value of TCL_TRACE_ARRAY so it no longer conflicts with the deprecated TCL_PARSE_PART1 flag. This should improve portability of C code. (stanton) + +10/6/98 (bug fix) The compile procedure for "if" incorrectly attempted +to match against the literal string "if", resulting in a stack +overflow when "::if" was compiled. It also would incorrectly accept +"if" instead of "elsif" in later clauses. (stanton) diff --git a/generic/tclCompCmds.c b/generic/tclCompCmds.c index bbb85dc..280ad62 100644 --- a/generic/tclCompCmds.c +++ b/generic/tclCompCmds.c @@ -9,7 +9,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.1.2.5 1998/10/06 00:35:22 stanton Exp $ + * RCS: @(#) $Id: tclCompCmds.c,v 1.1.2.6 1998/10/06 21:24:26 stanton Exp $ */ #include "tclInt.h" @@ -1055,7 +1055,7 @@ TclCompileIfCmd(interp, parsePtr, envPtr) } word = tokenPtr[1].start; numBytes = tokenPtr[1].size; - if (((numBytes == 2) && (strncmp(word, "if", 2) == 0)) + if ((tokenPtr == parsePtr->tokenPtr) || ((numBytes == 6) && (strncmp(word, "elseif", 6) == 0))) { tokenPtr += (tokenPtr->numComponents + 1); wordIdx++; -- cgit v0.12