Skip to content
Tcl Source Code View Ticket
Login

View Ticket

2016-06-23
08:22 • Ticket [d553228d9f] lassign + dict update == segmentation fault status still... artifact: 584e5485f4 user: dkf
08:21
[d553228d9f] Stop crashes in [dict update] with low refcount dictionaries. check-in: a633d16fae user: dkf tags: trunk
08:20 • Closed ticket [d553228d9f]: lassign + dict update == segmentation fault plus... artifact: 4e61e32180 user: dkf
08:20
[d553228d9f] Stop crashes in [dict update] with low refcount dictionaries. check-in: a1400f5f20 user: dkf tags: core-8-6-branch
2016-06-20
21:50 • Ticket [d553228d9f] lassign + dict update == segmentation fault status still... artifact: 4708e28453 user: dgp
2016-05-01
02:17 • Add attachment d553228d9f.patch to ticket [d553228d9f] artifact: f80a2936bc user: anonymous
02:15 • Ticket [d553228d9f] lassign + dict update == segmentation fault status still... artifact: e28699a805 user: anonymous
00:04 • New ticket [d553228d9f]. artifact: 8d054d50a5 user: pooryorick

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:42
  • a1400f5f20[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.