Tcl Source Code

View Ticket
Login
Ticket UUID: 16896d49fd10c97d3a6d6f5833760302c5e47086
Title: Tcl_DString append to self can crash.
Type: Bug Version: 8.6.5
Submitter: dah Created on: 2016-06-22 01:06:10
Subsystem: 44. UTF-8 Strings Assigned To: dgp
Priority: 5 Medium Severity: Minor
Status: Closed Last Modified: 2016-06-22 18:06:47
Resolution: Fixed Closed By: dgp
    Closed on: 2016-06-22 18:06:47
Description:
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.
User Comments: dgp added on 2016-06-22 18:06:47:
Fixed on all branches.

dgp added on 2016-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.

Attachments: