summaryrefslogtreecommitdiffstats
path: root/generic/tclStringObj.c
diff options
context:
space:
mode:
authorpooryorick <com.digitalsmarties@pooryorick.com>2018-07-22 20:44:16 (GMT)
committerpooryorick <com.digitalsmarties@pooryorick.com>2018-07-22 20:44:16 (GMT)
commit772d2da10b02fc06220a92d5f9d4f33b752a9553 (patch)
tree4ab12a61409a52b74fbd4ab1757bfbcf2d73e4bc /generic/tclStringObj.c
parent6667ddcb5458e53a3a29c314480b40c65d3c2283 (diff)
downloadtcl-772d2da10b02fc06220a92d5f9d4f33b752a9553.zip
tcl-772d2da10b02fc06220a92d5f9d4f33b752a9553.tar.gz
tcl-772d2da10b02fc06220a92d5f9d4f33b752a9553.tar.bz2
Fix for [ba921a8d98e02a96] - concatenating binary array with empty string yields the empty string.
Diffstat (limited to 'generic/tclStringObj.c')
-rw-r--r--generic/tclStringObj.c20
1 files changed, 9 insertions, 11 deletions
diff --git a/generic/tclStringObj.c b/generic/tclStringObj.c
index 3bb6112..2cda2c4 100644
--- a/generic/tclStringObj.c
+++ b/generic/tclStringObj.c
@@ -3065,24 +3065,22 @@ TclStringCat(
* Result will be pure byte array. Pre-size it
*/
+ int numBytes;
ov = objv;
oc = objc;
do {
Tcl_Obj *objPtr = *ov++;
- if (objPtr->bytes == NULL) {
- int numBytes;
+ Tcl_GetByteArrayFromObj(objPtr, &numBytes); /* PANIC? */
- Tcl_GetByteArrayFromObj(objPtr, &numBytes); /* PANIC? */
- if (numBytes) {
- last = objc - oc;
- if (length == 0) {
- first = last;
- } else if (numBytes > INT_MAX - length) {
- goto overflow;
- }
- length += numBytes;
+ if (numBytes) {
+ last = objc - oc;
+ if (length == 0) {
+ first = last;
+ } else if (numBytes > INT_MAX - length) {
+ goto overflow;
}
+ length += numBytes;
}
} while (--oc);
} else if (allowUniChar && requestUniChar) {