Tcl Source Code

View Ticket
Login
Ticket UUID: 876170
Title: ref count mismanagement in dict
Type: Bug Version: obsolete: 8.5a0
Submitter: kennykb Created on: 2004-01-13 16:11:42
Subsystem: 15. Dict Object Assigned To: dkf
Priority: 9 Immediate Severity:
Status: Closed Last Modified: 2004-01-14 16:38:33
Resolution: Fixed Closed By: dkf
    Closed on: 2004-01-14 09:38:33
Description:
The attached file causes Tcl to crash with a
corrupted free object list.  I haven't had time
yet to try to distill it to an irreducible minimum,
but I observe that the program doesn't fail if
the empty dictionaries are created with
[dict create] instead of using the canonical
null object.
User Comments: dkf added on 2004-01-14 16:38:33:

File Added - 73390: dict.patch

Logged In: YES 
user_id=79902

I attach the patch Peter sent to me by email which fixes
this and which I applied to the core with a few minor mods.
 Thanks very much, Peter!

pspjuth added on 2004-01-14 04:19:31:
Logged In: YES 
user_id=98900

Test case that triggers the bug if memdebug is on:

proc test {} {
    set successors [dict create x {c d}]
    dict set successors x a b
    dict get $successors x
}
test

pspjuth added on 2004-01-14 03:34:29:
Logged In: YES 
user_id=98900

The bug is in tclDictObj.c line 596.
There is a Tcl_DuplicateObj that should
be followed by a Tcl_IncrRefCount.

kennykb added on 2004-01-13 23:45:06:

File Added - 73286: trace

kennykb added on 2004-01-13 23:11:42:

File Added - 73274: uniqpfx.tcl

Attachments: