Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: c887514b1a0d640a868f053f716f2a6a5e89f118c8623090b8de0d82f78839c8
Ticket: 3422267ed6b79922ca6a69883d4e39901516443e
segmentation fault from deleting the the target of an imported alias during a trace on the target of the alias
User & Date: pooryorick on 2020-08-12 12:54:58
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 in an interprter built with
    -DPURIFY and --enable-symobls-debug:
    
    <code><verbatim>
    variable res {}
    
    proc p1 args {
        return success
    }
    namespace eval ns1 {
        namespace export *
    }
    interp alias {} [namespace current]::ns1::p2 {} [namespace current]::p1
    namespace eval ns2 {
        namespace import [namespace parent]::ns1::p2
    }
    proc ondelete {oldname newname op} {
        variable res
        namespace delete ns1
        catch {
            ns1::p2
        }  res
    }
    
    trace add command ns2::p2 delete [namespace which ondelete]
    rename ns2::p2 {}
    rename p1 {}
    </verbatim></code>
    
    The expected result is an error message about <code>ns1::p2</code>
    
    <code><verbatim>
    invalid command name "ns1::p2"
    </verbatim></code>
    
    
    The issue is that in <code>tclNamesp.c:DeleteImportedCmd</code>,
    <code>realCmdPtr</code> points to memory that has already been deallocated.
    For imported commands reference counting and cleanup is currently incomplete.
    
  5. is_private changed to: "0"
  6. login: "pooryorick"
  7. priority changed to: "5 Medium"
  8. resolution changed to: "None"
  9. severity changed to: "Minor"
  10. status changed to: "Open"
  11. submitter changed to: "pooryorick"
  12. subsystem changed to: "21. [namespace]"
  13. title changed to:
    segmentation fault from deleting the the target of an imported alias during a trace on the target of the alias
    
  14. type changed to: "Bug"