Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: 65500073f7302fe82835f35338bd8f4ca0deea8d6adf687bc21ffb926d2f7af5
Ticket: 45b9faf103f2fd0f7c4a69606b358bb68dbd2596
[try] interaction with local variable names produces segmentation fault
User & Date: pooryorick on 2019-04-08 09:38:22
Changes

  1. assignee changed to: "nobody"
  2. closer changed to: "nobody"
  3. cmimetype changed to: "text/x-fossil-wiki"
  4. comment changed to:
    The following script produces a segmentation fault:
    
    <code><verbatim>
    proc main {} {
        eval {
            try {
                lindex 5
            } on ok res {} 
        }
        puts $res
    }
    main
    </verbatim></code>
    
    The issue is: 
    
        [https://core.tcl.tk/tcl/artifact?udc=1&ln=4814&name=7abc6eff76e59d6d|tclCmdMZ.c:TryPostBody]
        extracts a variable name from a <code>Tcl_Obj</code>, causing a list
        internal representation to be created on that <code>Tcl_Obj</code>, and the
        original value of that <code>Tcl_Obj</code> to become the first item in the
        list, with a <code>refCount</code> of 1.
    
        On the next line, <code>Tcl_ObjSetVar2</code> is called, and
        [https://core.tcl.tk/tcl/artifact?udc=1&ln=738&name=f5bfe8cd3b7e5fd8|TclObjLookupVarEx]
        subsequently obtains that same <code>Tcl_Obj</code> from the cache of local
        variable names and frees that same list internal representation.
    
        At this point, <code>part1Ptr</code> is a reference to that freed
        <code>Tcl_Obj</code>.
    
  5. foundin changed to: "core-8-branch"
  6. is_private changed to: "0"
  7. login: "pooryorick"
  8. priority changed to: "5 Medium"
  9. resolution changed to: "None"
  10. severity changed to: "Minor"
  11. status changed to: "Open"
  12. submitter changed to: "pooryorick"
  13. subsystem changed to: "18. Commands M-Z"
  14. title changed to:
    [try] interaction with local variable names produces segmentation fault
    
  15. type changed to: "Bug"