summaryrefslogtreecommitdiffstats
path: root/generic/tclObj.c
diff options
context:
space:
mode:
authordgp <dgp@users.sourceforge.net>2016-03-23 15:19:05 (GMT)
committerdgp <dgp@users.sourceforge.net>2016-03-23 15:19:05 (GMT)
commit422d353b0a2e391d172664cb529dc42ac783b708 (patch)
tree96d45885dc02d811393a10b22a2baf0a01ffffdb /generic/tclObj.c
parent847f2ba0d5e6d3bdc2c069bb54dcea60f2174cd0 (diff)
downloadtcl-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.c7
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 */