Skip to content
Tcl Source Code History Of Ticket 218979
Login

History Of Ticket 218979

Artifacts Associated With Ticket 218979

  1. Ticket change [36a40fef7b] (rid 107143) by nobody on 2000-10-26 01:08:53:

    1. assignee initialized to: "nobody"
    2. cmimetype initialized to: "text/plain"
    3. comment initialized to:
      OriginalBugID: 3412 Bug
      Version: 8.2
      SubmitDate: '1999-11-05'
      LastModified: '2000-01-20'
      Severity: CRIT
      Status: Released
      Submitter: techsupp
      ChangedBy: hobbs
      OS: Windows NT
      OSVersion: 4.0 / SP4
      FixedDate: '2000-01-20'
      FixedInVersion: 8.3
      ClosedDate: '2000-10-25'
      
      
      Name:
      Borivoj Tydlitat
      
      ReproducibleScript:
      //d> tclsh (or tclshd)
          % proc foo {args} {
            foreach v $args {
              upvar $v var
                  puts "variable $v existence: [info exists var]"
            }
          }
          % foo a
          variable a existence: 0
          % catch [info body foo]
      
      ObservedBehavior:
      coredumps (crashes) on NT 4.0, reading NULL page
          correctly returns 1 on AIX 4.2 (NULL page is readable on AIX without
          generating an exception)
      
      
      
      Verified on Linux with 8.3b2. Minimal case seems to be:
      
      --------------------------------------------
      
      proc foo {} {set a 1}
      foo
      catch [info body foo]
      
      --------------------------------------------
      
      In other words, a proc with a local variable is enough to do it.  The proc must be compiled before the catch.  Perhaps the compiler is doing something uncouth with compiledLocals?
      
      - eric
      
      -- 01/17/2000 ericm
      
      The real problem lies in that catch should never use another's
      byte code, which is the case here.  Take the following example:
      
      proc foo a { set b $a }
      foo 1
      proc bar {} { set c 4; set d 3; set a 2; catch [info body foo] ; set d }
      bar
      returns => 4
      
      In foo, the indexed compiled locals a 1:a and 2:b.  What the catch
      above will do is get the value of local 1 in bar and set local 2 to it
      (d gets c in this case). 
      -- 01/17/2000 hobbs
      Well, there were two ways to go about solving this, and we decided
      on what might not be the most "correct" path, but one that should
      work 100%.  It seems that the only possible way to cause the above
      offensive bytecode use is through the use of [info body].  Thus,
      we changed [info body] to always return a string.
      
      The second, "correct" solution requires adding several extra checks
      to Tcl_EvalObjEx, checking that the bytecode we are about to use is
      actually being used in the correct proc context.  I've left that
      code there, #def'd out, so that we have it for reference should it
      come to pass that the above assumption (that [info body] is the only
      thing that can cause this to pass) is false. 
      -- 01/20/2000 hobbs
      
      
      
    4. foundin initialized to: "obsolete: 8.2"
    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:
      improper use of catch command crashes the interpreter
      
    11. type initialized to: "Bug"
  2. Ticket change [7963efb78f] (rid 90117) by welch on 2000-10-26 08:33:07:

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