Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: 357c12e1db33811140ac230c0ce9c23914e2a1f2
Ticket: 219037ffffffffffffffffffffffffffffffffff
[incr Tcl] makes call to Tcl info in a way that segfaults
User & Date: nobody on 2000-10-26 01:09:43
Changes

  1. assignee changed to: "nobody"
  2. cmimetype changed to: "text/plain"
  3. comment changed to:
    OriginalBugID: 4064 Bug
    Version: 8.2.3
    SubmitDate: '2000-01-24'
    LastModified: '2000-03-31'
    Severity: CRIT
    Status: Released
    Submitter: techsupp
    ChangedBy: hobbs
    OS: Solaris
    OSVersion: SunOS 5.6
    Machine: An ugly grey/beige box with the words
    FixedDate: '2000-03-31'
    FixedInVersion: 8.3.1
    ClosedDate: '2000-10-25'
    
    
    Name:
    
    Dave Cuthbert
    
    
    Extensions:
    
    incr Tcl 3.0.1
    
    
    Comments:
    
    The problem is that the implementation of info vars just calls the AppendLocals command to add in all of the variables from the current procedure.  It doesn't check to see if a procedure is active (hence the null pointer check in the patch).
    
    
    Don't know if this is fixed in [incr Tcl] 3.1 (I'm running 3.0); unfortunately, our firewall blocks CVS traffic. :-(  Haven't run it, but the source to 8.3b2 looks like it has the same bug.
    
    
    ReproducibleScript:
    
    I know this involves [incr Tcl], but don't dismiss this just yet.  I think it's something that should be fixed in the core.
    
    
    Running itclsh3.0 with the following:
    
        class A { }
    
        A a
    
        a info vars
    
    
    causes a segmentation fault.  (Note that the 3rd line should be info variables to get the desired behavior, but Tcl still shouldn't segfault here).
    
    
    ObservedBehavior:
    
    (dbx) where
    
    =>[1] AppendLocals(interp = 0x489f8, listPtr = 0x68918, pattern = (nil), includeLinks = 1), line 1291 in "tclCmdIL.c"
    
      [2] InfoVarsCmd(dummy = (nil), interp = 0x489f8, objc = 2, objv = 0x4a724), line 1761 in "tclCmdIL.c"
    
      [3] Tcl_InfoObjCmd(clientData = (nil), interp = 0x489f8, objc = 2, objv = 0x4a724), line 451 in "tclCmdIL.c"
    
      [4] Itcl_DefaultInfoCmd(0x0, 0x489f8, 0x2, 0x4a724, 0x22c68, 0x0), at 0x22cf4
    
      [5] HandleEnsemble(0x52c30, 0x489f8, 0x2, 0x4a724, 0x6bda0, 0x489f8), at 0x17f68
    
      [6] InvokeImportedCmd(clientData = 0x6daa8, interp = 0x489f8, objc = 2, objv = 0x4a724), line 1453 in "tclNamesp.c"
    
      [7] Itcl_EvalArgs(0x489f8, 0x2, 0x4a724, 0x53738, 0x0, 0xefffdfc8), at 0x20dbc
    
      [8] Itcl_HandleInstance(0x6bce0, 0x489f8, 0x3, 0x4a720, 0x52028, 0x0), at 0x1bd9c
    
      [9] TclExecuteByteCode(interp = 0x489f8, codePtr = 0x739e0), line 844 in "tclExecute.c"
    
      [10] Tcl_EvalObjEx(interp = 0x489f8, objPtr = 0x51dc8, flags = 0), line 2698 in "tclBasic.c"
    
      [11] Tcl_RecordAndEvalObj(interp = 0x489f8, cmdPtr = 0x51dc8, flags = 0), line 142 in "tclHistory.c"
    
      [12] Tcl_Main(argc = 1, argv = 0xefffeb6c, appInitProc = 0x153b4 = &Tcl_AppInit()), line 236 in "tclMain.c"
    
      [13] main(0x1, 0xefffeb6c, 0xefffeb74, 0x42000, 0x0, 0x0), at 0x15394
    
    (dbx)
    
    
    DesiredBehavior:
    
    No segfault.  Maybe an error message if the info vars command doesn't make sense on an [incr Tcl] object, but that should be trapped by [incr Tcl], not Tcl.
    
    
    Patch:
    
    *** tclCmdIL.c.orig     Sun Jan 23 18:49:02 2000
    
    --- tclCmdIL.c.new      Sun Jan 23 18:49:08 2000
    
    ***************
    
    *** 1757,1763 ****
    
                    entryPtr = Tcl_NextHashEntry(&search);
    
                }
    
            }
    
    !     } else if {
    
            AppendLocals(interp, listPtr, simplePattern, 1);
    
          }
    
    
    --- 1757,1763 ----
    
                    entryPtr = Tcl_NextHashEntry(&search);
    
                }
    
            }
    
    !     } else if (((Interp *)interp)->varFramePtr->procPtr != 0) {
    
            AppendLocals(interp, listPtr, simplePattern, 1);
    
          }
    
    
    PatchFiles:
    
    generic/tclCmdIL.c
    
    
    
    
    Fixed in 8.3.1. 
    -- 03/31/2000 hobbs
    
  4. foundin changed to: "final: 8.2.3"
  5. priority changed to: "5 Medium"
  6. resolution changed to: "None"
  7. status changed to: "Open"
  8. submitter changed to: "nobody"
  9. subsystem changed to: "10. Objects"
  10. title changed to:
    [incr Tcl] makes call to Tcl info in a way that segfaults
    
  11. type changed to: "Bug"