Tcl Source Code

View Ticket
Login
Ticket UUID: 551061651d07944a19c76706530f51ea67b9abae
Title: Crash evaluating [uplevel 1 {info vars _u_defer_var}] from inside a itcl class proc
Type: Bug Version: 8.6.6
Submitter: bigfaceworm Created on: 2017-04-14 18:56:12
Subsystem: 81. Bundled Packages Assigned To: dgp
Priority: 5 Medium Severity: Severe
Status: Closed Last Modified: 2017-04-17 15:52:24
Resolution: Invalid Closed By: dgp
    Closed on: 2017-04-17 15:52:24
Description:
This has been reproduced with ActiveState releases 8.6.5 and 8.6.6

The following script causes a segmentation fault (core dump).

Unsure of the category (don't know if it's OO or uplevel), please assign the category appropriately.

# ---------------begin script-------------------
package require Itcl

proc ::try_uplevel {} {
  return [uplevel 1 [list ::info vars _u_defer_var]]
}

itcl::class ::test_class {
  constructor {} {}

  public proc test_via_proc {} {
    ::try_uplevel
  }
}

::test_class::test_via_proc
# ---------------end script-------------------

The problem is that the Tcl core code is getting a null pointer and dereferencing it in tclVar.c, AppendLocals(....)

  if (iPtr->varFramePtr->isProcCallFrame & FRAME_IS_METHOD) {
	CallContext *contextPtr = iPtr->varFramePtr->clientData;
	Method *mPtr = contextPtr->callPtr->chain[contextPtr->index].mPtr;

the contextPtr is null.
User Comments: dgp added on 2017-04-17 15:52:24:
The problem is in Itcl.  Simplified demo entered
into Itcl's ticket system.

https://core.tcl.tk/itcl/tktview/a03f579f7db89cabe7528c30a44d7fc1c95f427e