lassign + dict update == segmentation fault
Closed / Fixedd553228d9fcbd1722a85d6fc99dbbfb60176480fCreated 11 years agoUpdated 10 years ago
Descriptionwiki2016-05-01 00:04:11
The following script produces a segmentation fault:
apply {{} {
set item hello
lassign $item one item
dict update item item item two two {}
}}
Referenced by2
a633d16fae[d553228d9f] Stop crashes in [dict update] with low refcount dictionaries. check-in2016-06-23 08:21:42a1400f5f20[d553228d9f] Stop crashes in [dict update] with low refcount dictionaries. check-in2016-06-23 08:20:16
anonymous (claiming to be aspect)plain2016-05-01 02:15:58
Slightly simpler test script:
proc t {} {lassign {} item; dict update item item item two two {}}
t
My suspicion is that the initial loop in INST_DICT_UPDATE_START isn't robust against dictPtr being free()d while it's looping, and [lassign] contributes by only by putting a value in $item with low refcount.
The attached patch eliminates the segfault with this test script, but I haven't tested it any further:
dgp Ticket [d553228d9f]: 5 changes
[History diff]2016-06-20 21:50:10
dkf Closed ticket [d553228d9f].
[History diff]2016-06-23 08:20:51
dkfhtml2016-06-23 08:22:30
Good test case and patch. In 8.6 and trunk.
Log in (anonymous is fine) to add a comment.