Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: ee15399deeadc63e05146784f6b2a99fde99750a
Ticket: 218820ffffffffffffffffffffffffffffffffff
failure accessing local variables
User & Date: nobody on 2000-10-26 01:05:57
Changes

  1. assignee changed to: "nobody"
  2. cmimetype changed to: "text/plain"
  3. comment changed to:
    OriginalBugID: 2243 Bug
    Version: 8.1.1
    SubmitDate: '1999-06-16'
    LastModified: '1999-07-01'
    Severity: MED
    Status: Released
    Submitter: techsupp
    ChangedBy: foster
    OS: Other
    OSVersion: WinNT, AIX, Solaris, Linux
    Machine: NA
    FixedDate: '1999-06-16'
    FixedInVersion: 8.2b1
    ClosedDate: '2000-10-25'
    
    
    Name:
    
    Borivoj Tydlitat
    
    
    
    CustomShell:
    
    No
    
    
    
    ReproducibleScript:
    
    We observed the behavior in a fairly complex script only and were not
    
        able to reproduce it in a short one due to nature of the problem. This
    
        the relevant fragment:
    
        
    
        set drat [lindex $seg 0]
    
        if {[info exists drat]} {
    
        puts "should print drat because it exists"
    
            puts "after, drat=$drat"
    
        } else {
    
           puts "really bad, drat doesn't exist"
    
        }
    
        
    
        Output:
    
        should print drat because it exists
    
        can't read "": no such variable
    
        
    
        Our analysis:
    
        If INSTR_LOAD_SCALAR1 bytecode is generated with argument byte > 0x7F,
    
        the interpreter treats this argument as signed value, resulting in
    
        negative
    
        localIndex passed to TclGetIndexedScalar, which fails or returns invalid
    
        pointer.
    
    
    
    ObservedBehavior:
    
    Local variable seems not to exist, though it was created. 
    
        Occurs in a complex script only.
    
    
    
    Patch:
    
    *** tclExecute.old      Wed Jun 16 14:34:27 1999
    
    --- tclExecute.c        Wed Jun 16 13:55:49 1999
    
    ***************
    
    *** 1052,1058 ****
    
    
    
            case INST_LOAD_SCALAR1:
    
      #ifdef TCL_COMPILE_DEBUG
    
    !           opnd = TclGetInt1AtPtr(pc+1);
    
                DECACHE_STACK_INFO();
    
                valuePtr = TclGetIndexedScalar(interp, opnd,
    
                        /*leaveErrorMsg*/ 1);
    
    --- 1052,1058 ----
    
    
    
            case INST_LOAD_SCALAR1:
    
      #ifdef TCL_COMPILE_DEBUG
    
    !           opnd = TclGetUInt1AtPtr(pc+1);
    
                DECACHE_STACK_INFO();
    
                valuePtr = TclGetIndexedScalar(interp, opnd,
    
                        /*leaveErrorMsg*/ 1);
    
    ***************
    
    *** 1067,1073 ****
    
                TRACE_WITH_OBJ(("%u => ", opnd), valuePtr);
    
      #else /* TCL_COMPILE_DEBUG */
    
                DECACHE_STACK_INFO();
    
    !           valuePtr = TclGetIndexedScalar(interp, TclGetInt1AtPtr(pc+1),
    
                        /*leaveErrorMsg*/ 1);
    
                CACHE_STACK_INFO();
    
                if (valuePtr == NULL) {
    
    --- 1067,1073 ----
    
                TRACE_WITH_OBJ(("%u => ", opnd), valuePtr);
    
      #else /* TCL_COMPILE_DEBUG */
    
                DECACHE_STACK_INFO();
    
    !           valuePtr = TclGetIndexedScalar(interp, TclGetUInt1AtPtr(pc+1),
    
                        /*leaveErrorMsg*/ 1);
    
                CACHE_STACK_INFO();
    
                if (valuePtr == NULL) {
    
    
    
    PatchFiles:
    
    tclExecute.c
    
    
    
    
    
    06/16/1999 14:39 - stanton - I have applied the patch and added a test case.
    
  4. foundin changed to: "final: 8.1.1"
  5. priority changed to: "5 Medium"
  6. resolution changed to: "None"
  7. status changed to: "Open"
  8. submitter changed to: "nobody"
  9. subsystem changed to: "69. Other"
  10. title changed to: "failure accessing local variables"
  11. type changed to: "Bug"