Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: 275c68d7c22a442c29571484181da4fbdaff8ebc277808087c8d0e026ec306bb
Ticket: 3422267ed6b79922ca6a69883d4e39901516443e
segmentation fault from deleting the the target of an imported alias during a trace on the target of the alias
User & Date: aku on 2020-08-31 17:44:58
Changes

  1. comment changed to:
    The following script produces a segmentation fault in an interpreter built with
    -DPURIFY and --enable-symbols-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.
    
  2. login: "aku"
  3. mimetype: "text/plain"