Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: 179d8e33ae3039bb676053d84ed0c6080e243e3a3f1f83aa8606511322c6d890
Ticket: ccc448a6bfd59cbdb2bd5cfd3392e386994883aa
namespace ensemble subcommand name prefix matching and a subsequent error results in a segmentation fault
User & Date: pooryorick on 2021-09-01 21:32:18
Changes

  1. assignee changed to: "nobody"
  2. closer changed to: "nobody"
  3. cmimetype changed to: "text/x-fossil-wiki"
  4. comment changed to:
    When passed as a file to tclsh, the following script, with <code>eva</code>
    missing the final <code>l</code>, results in a segmentation fault:
    
    <code><verbatim>
        namespace eva n1 {error hello}
    </verbatim></code>
    
    An alternate script that produces the same result is:
    
    <code><verbatim>
        namespace eval n1 {
            namespace ensemble create
            namespace export *
            proc p1 args {error hello}
        }
        namespace eva n1 {::n1 p1}
    </verbatim></code>
    
    The reason is that <code>TclSpellFix</code> sets <code>NULL</code> as the first
    object pointer in <code>iPtr->ensembleRewrite.sourceObjs</code> and then later,
    in <code>NRNamespaceEvalCmd</code>, <code>TclFetchEnsembleRoot</code> copies a
    pointer to this array into <code>framePtr->objv</code>. Next, when an error
    occurs, <code>TclLogCommandInfo</code> accesses this array and trips on the
    <code>NULL</code>, causing the segmentation fault.
    
  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:
    namespace ensemble subcommand  name prefix matching and a subsequent error results in a segmentation fault
    
  14. type changed to: "Bug"