Skip to content
Tcl Source Code View Ticket
Login

View Ticket

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.