diff options
author | dgp <dgp@users.sourceforge.net> | 2016-03-23 15:19:05 (GMT) |
---|---|---|
committer | dgp <dgp@users.sourceforge.net> | 2016-03-23 15:19:05 (GMT) |
commit | 422d353b0a2e391d172664cb529dc42ac783b708 (patch) | |
tree | 96d45885dc02d811393a10b22a2baf0a01ffffdb /generic/tclObj.c | |
parent | 847f2ba0d5e6d3bdc2c069bb54dcea60f2174cd0 (diff) | |
download | tcl-422d353b0a2e391d172664cb529dc42ac783b708.zip tcl-422d353b0a2e391d172664cb529dc42ac783b708.tar.gz tcl-422d353b0a2e391d172664cb529dc42ac783b708.tar.bz2 |
Tcl_InitStringRep() bug. Truncation assumed length == allocated. Wrong!
Convert "bytearray" Tcl_ObjType to used new facilities. No longer directly
refers to bytes or length fields, or any ckalloc of string rep.
Diffstat (limited to 'generic/tclObj.c')
-rw-r--r-- | generic/tclObj.c | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/generic/tclObj.c b/generic/tclObj.c index 3fb344e..d1fde0e 100644 --- a/generic/tclObj.c +++ b/generic/tclObj.c @@ -1771,11 +1771,8 @@ Tcl_InitStringRep( } } else { /* objPtr->bytes != NULL bytes == NULL - Truncate */ - assert((int)numBytes <= objPtr->length); - if (objPtr->length > (int)numBytes) { - objPtr->bytes = (char *)ckrealloc(objPtr->bytes, numBytes+1); - objPtr->length = (int)numBytes; - } + objPtr->bytes = (char *)ckrealloc(objPtr->bytes, numBytes+1); + objPtr->length = (int)numBytes; } /* Terminate */ |