Skip to content
Tcl Source Code View Ticket
Login

View Ticket

2016-06-22
18:06 • Closed ticket [16896d49fd]: Tcl_DString append to self can crash. plus 7 oth... artifact: c2da185527 user: dgp
18:05
[16896d49fd] Tcl_DStrings should tolerate appends to self. check-in: ad87c3093e user: dgp tags: trunk
18:04
[16896d49fd] Tcl_DStrings should tolerate appends to self. check-in: 4add8eddc5 user: dgp tags: core-8-6-branch
17:38
[16896d49fd] Tcl_DStrings should tolerate appends to self. check-in: cd612518e5 user: dgp tags: core-8-5-branch
15:49 • Ticket [16896d49fd] Tcl_DString append to self can crash. status still Open ... artifact: 9e12fc28db user: dgp
15:45 • Ticket [16896d49fd]: 3 changes artifact: a4420fcb5a user: dgp
01:08 • Add attachment DString3.diff to ticket [16896d49fd] artifact: def46fb88a user: dah
01:06 • New ticket [16896d49fd] Add usage note to Tcl_DStringAppend, Tcl_DStringAppendEl... artifact: 47ddb941a6 user: dah

Tcl_DString append to self can crash.

Closed / Fixed16896d49fd10c97d3a6d6f5833760302c5e47086Created 10 years agoUpdated 10 years ago
Descriptionplain2016-06-22 01:06:10
In light of http://core.tcl.tk/tk/info/787adc5ed7acb2a3

I propose adding some guidance to the docs for Tcl_DStringAppend and Tcl_DStringAppendElement. These functions must never be given an argument where its memory overlaps with the memory in DString's string field (due to potential for realloc), even if the string is kept small, it still sets a bad example.
Referenced by3
dgpplain2016-06-22 15:45:29
Turns out we had similar troubles with
appends of Tcl_Obj values:

http://core.tcl.tk/tcl/tktview?name=2603158

I think we're better off fixing the bug instead
of documenting it, now that it's become clear.
dgp Ticket [16896d49fd]: 4 changes [History diff]2016-06-22 15:49:39
dgpplain2016-06-22 18:06:47
Fixed on all branches.
Log in (anonymous is fine) to add a comment.