|
2009-03-31
| ||
| 00:48 | • Closed ticket [2603158fff]: Tcl_AppendObjToObj cannot append obj to self plu... artifact: ef15c2ea32 user: dgp | |
|
2009-02-16
| ||
| 11:06 | • Ticket [2603158fff]: 4 changes artifact: 61bbbcc455 user: dgp | |
| 03:27 | • Ticket [2603158fff]: 4 changes artifact: 7eb2db1e2c user: dkf | |
|
2009-02-15
| ||
| 18:10 | • New ticket [2603158fff]. artifact: a751f565cf user: dgp | |
Tcl_AppendObjToObj cannot append obj to self
Closed / Fixed2603158fffffffffffffffffffffffffffffffffCreated 18 years agoUpdated 18 years ago
Descriptionplain2009-02-15 18:10:53
This will crash:
Tcl_AppendObjToObj(objPtr, objPtr);
Same problem with
int numBytes;
char *bytes
= Tcl_GetStringFromObj(objPtr, &numBytes);
Tcl_AppendToObj(objPtr, bytes, numBytes);
and other equivalents.
Same problem with
int numChars;
Tcl_UniChar *unicode
= Tcl_GetUnicodeFromObj(objPtr, &numChars);
Tcl_AppendUnicodeToObj(objPtr, unicode, numChars);
The latest optimization for bytearray values
does work. That's the only case that does.
(Good work, dkf!)
dkfplain2009-02-16 03:27:16
I'd not expect the T_GSFO->T_ATO or T_GUFO->T_AUTO versions to work. There simply isn't quite enough information passed to Tcl's internals to be able to spot the sharing (if you think there is, consider the case where you're appending everything but the first character so a pointer equality test won't spot the issue...) However, T_AOTO should be able to cope: that's got precisely the right info to know when it has to be careful. (Or we can assume that expanding the buffers won't necessarily preserve the pointers to any character/unicode array, but will preserve the lengths, which is what I did. And that's why it won't work for the other cases.)
dgpplain2009-02-16 11:06:30
fixed in HEAD
dgpplain2009-03-31 00:48:09
fix backported.
Log in (anonymous is fine) to add a comment.