Skip to content
Tcl Source Code History Of Ticket 218529ffffffffff
Login

History Of Ticket 218529ffffffffff

Artifacts Associated With Ticket 218529ffffffffff

  1. Ticket change [a962864558] (rid 99140) by nobody on 2000-10-26 01:01:46:

    1. assignee initialized to: "nobody"
    2. cmimetype initialized to: "text/plain"
    3. comment initialized to:
      OriginalBugID: 898 Bug
      Version: 8.0.5
      SubmitDate: '1998-12-03'
      LastModified: '1999-04-16'
      Severity: CRIT
      Status: Released
      Submitter: admin
      ChangedBy: stanton
      OS: All
      OSVersion: NA
      Machine: NA
      FixedDate: '1999-04-16'
      FixedInVersion: 8.1b3
      ClosedDate: '2000-10-25'
      
      
      ReproducibleScript:
      
      running the following script will cause a seg fault or some such.
      
      
        set x {{0}}
      
        while {1} {
      
          if !$x {puts yes}
      
        }
      
      
      what happens is the bytecode interpreter overruns the catch stack, because the compiled code is missing an endCatch.
      
      
      Patch:
      
      Index: tclCompile.c
      
      ===================================================================
      
      RCS file: /cvsroot/tcl/generic/tclCompile.c,v
      
      retrieving revision 1.11
      
      diff -c -p -r1.11 tclCompile.c
      
      *** tclCompile.c1998/09/14 18:39:581.11
      
      --- tclCompile.c1998/11/27 03:04:26
      
      ***************
      
      *** 5,11 ****
      
         *of commands (like quoted strings or nested sub-commands) into a
      
         *sequence of instructions ("bytecodes"). 
      
         *
      
      !  * Copyright (c) 1996-1997 Sun Microsystems, Inc.
      
         *
      
         * See the file "license.terms" for information on usage and redistribution
      
         * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
      
      --- 5,11 ----
      
         *of commands (like quoted strings or nested sub-commands) into a
      
         *sequence of instructions ("bytecodes"). 
      
         *
      
      !  * Copyright (c) 1996-1998 Sun Microsystems, Inc.
      
         *
      
         * See the file "license.terms" for information on usage and redistribution
      
         * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
      
      *************** CompileExprWord(interp, string, lastChar
      
      *** 6321,6329 ****
      
        envPtr->excRangeArrayNext = startRangeNext;
      
        inlineCode = 0;
      
            } else {
      
      ! TclEmitOpcode(INST_END_CATCH, envPtr);
      
        TclEmitForwardJump(envPtr, TCL_UNCONDITIONAL_JUMP, &jumpFixup);
      
        envPtr->excRangeArrayPtr[range].catchOffset = TclCurrCodeOffset();
      
            }
      
        }
      
      
      --- 6321,6330 ----
      
        envPtr->excRangeArrayNext = startRangeNext;
      
        inlineCode = 0;
      
            } else {
      
      ! TclEmitOpcode(INST_END_CATCH, envPtr); /* for ok case */
      
        TclEmitForwardJump(envPtr, TCL_UNCONDITIONAL_JUMP, &jumpFixup);
      
        envPtr->excRangeArrayPtr[range].catchOffset = TclCurrCodeOffset();
      
      + TclEmitOpcode(INST_END_CATCH, envPtr); /* for error case */
      
            }
      
        }
      
      
      PatchFiles:
      
      tcl/generic/tclCompile.c
      
      
      Comments:
      
      note, this code in CompileExprWord() is analagous to code in TclCompileExprCmd(), which is already correct.
      
      
      tests/if.test probably needs a few testcases added, since only a few of the if-expression optimizations ever get exercised.
      
      
      and in general, this type of stack-overflow error won't be caught by the testsuite, since few of the tests live long enough to seriously overflow the stack.
      
      
      
      
      Not reproducible in latest 8.1 code.
      
    4. foundin initialized to: "final: 8.0.5"
    5. priority initialized to: "5 Medium"
    6. resolution initialized to: "None"
    7. status initialized to: "Open"
    8. submitter initialized to: "nobody"
    9. subsystem initialized to: "10. Objects"
    10. title initialized to:
      compiler emits bad code for "if" expressions: crash in "set 
      
    11. type initialized to: "Bug"
  2. Ticket change [61fe8ea98f] (rid 92338) by welch on 2000-10-26 08:24:12:

    1. closedate changed to: "2000-10-26T01:24:12"
    2. closer changed to: "welch"
    3. priority changed to: "2"
    4. resolution changed to: "Fixed"
    5. status changed to: "Closed"