summaryrefslogtreecommitdiffstats
path: root/generic/tclBinary.c
diff options
context:
space:
mode:
authorsebres <sebres@users.sourceforge.net>2019-02-05 21:59:46 (GMT)
committersebres <sebres@users.sourceforge.net>2019-02-05 21:59:46 (GMT)
commit9d568b1bdd58e6080af0bf086cc040a63ce4f549 (patch)
tree2b109318f0ee4346319fcf70f439f308906fc59f /generic/tclBinary.c
parent73b6b4eab6a4b0a4ecf0f0c6bcf00bd815c34dd5 (diff)
downloadtcl-9d568b1bdd58e6080af0bf086cc040a63ce4f549.zip
tcl-9d568b1bdd58e6080af0bf086cc040a63ce4f549.tar.gz
tcl-9d568b1bdd58e6080af0bf086cc040a63ce4f549.tar.bz2
fixes segfault [bd94500678]: Tcl_UtfToUniChar/TclUtfToUniChar could don't advance source pointer in case it produce high surrogate, so it should be repeated with the same value of ch (returned previously), in order to generate low surrogate hereafter (and to avoid endless cycle).
Diffstat (limited to 'generic/tclBinary.c')
-rw-r--r--generic/tclBinary.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/generic/tclBinary.c b/generic/tclBinary.c
index 5b26b2f..e912c1f 100644
--- a/generic/tclBinary.c
+++ b/generic/tclBinary.c
@@ -549,6 +549,7 @@ SetByteArrayFromAny(
int improper = 0;
const char *src, *srcEnd;
unsigned char *dst;
+ Tcl_UniChar ch = 0;
ByteArray *byteArrayPtr;
Tcl_ObjIntRep ir;
@@ -565,7 +566,6 @@ SetByteArrayFromAny(
byteArrayPtr = ckalloc(BYTEARRAY_SIZE(length));
for (dst = byteArrayPtr->bytes; src < srcEnd; ) {
- Tcl_UniChar ch = 0;
src += TclUtfToUniChar(src, &ch);
improper = improper || (ch > 255);
*dst++ = UCHAR(ch);