Tcl Source Code

View Ticket
Login
Ticket UUID: 1502071
Title: Tcl_GetMaster can access freed interp (interp-16.1)
Type: Bug Created on: 2006-06-07 07:31:19
Submitter: mistachkin Assigned to: hobbs
Subsystem: 20. [interp] Severity:
Priority: 6 Last modified: 2009-03-17 15:04:02
Status: Open Closed by:
Resolution: None Closed on:
Version: obsolete: 8.5a4
Description:
In the interp-16.1 test, the master interpreter {xxx}
is deleted prior to the slave interpreter {xxx yyy}. 
Deletion of the master interpreter leaves hanging
references to it in the interpInfo.slave.masterInterp
field for each of it's slave interpreters.

If Tcl_GetMaster(slaveInterp) is called after the
master interpreter has been freed, the result points to
undefined memory.

Currently, the only way I know of to see this problem
is to apply my Tcl_CancelEval patch and run the test suite.

After careful study, I have come up with a potential
fix for this issue.

Basically, when any slave interpreter is deleted we
reset the master for each of it's slave interpreters to
be it's master's master (which may be NULL).  I'm not
sure if this is the best solution; however, it appears
to work.

This bug also affects 8.4.
User Comments:
nobody added on 2006-06-11 05:21:23:
Logged In: NO 


After more research, I don't think my original way to fix
this issue was right.  I avoided this issue in my
Tcl_CancelEval patch by working around it; however, the
issue itself still merits further study.

msofer added on 2007-09-11 22:32:01:
Logged In: YES 
user_id=148712
Originator: NO

When an interp is deleted, all its slaves are deleted too: when the slave command in the master goes, its deleteProc deletes the slave interp. Ie: this does not seem to be a bug that can be triggered by any script. It seems like one of "pilot error", "insufficient docs for the C api" or "incomplete C api for interps".

Or else I misunderstood completely.

mistachkin added on 2009-03-17 14:54:19:
This bug may be related to 1502071.

mistachkin added on 2009-03-17 15:04:02:
What I meant was: This bug may be related to 2577420.