summaryrefslogtreecommitdiffstats
path: root/generic/tclEncoding.c
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2019-12-08 16:33:18 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2019-12-08 16:33:18 (GMT)
commitd67affb10098d8289d0fd12a5ea738068740ef39 (patch)
tree5f47e0b599589945cf71b5418afd157c85e96544 /generic/tclEncoding.c
parentbf4f51ce7866dc5c5ce3acf483636f7a281e3d18 (diff)
downloadtcl-d67affb10098d8289d0fd12a5ea738068740ef39.zip
tcl-d67affb10098d8289d0fd12a5ea738068740ef39.tar.gz
tcl-d67affb10098d8289d0fd12a5ea738068740ef39.tar.bz2
Fix Valgrind problem reported as follow-up in [fc4393e9b0]. Since it happens only for TCL_UTF_MAX>3 it's not actully a 'bug' in 8.6, but it might be a corner-case not handled well in 8.7
Diffstat (limited to 'generic/tclEncoding.c')
-rw-r--r--generic/tclEncoding.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/generic/tclEncoding.c b/generic/tclEncoding.c
index e080d6e..69075bd 100644
--- a/generic/tclEncoding.c
+++ b/generic/tclEncoding.c
@@ -2361,11 +2361,11 @@ UtfToUtfProc(
dst += Tcl_UniCharToUtf(*chPtr, dst);
} else {
src += TclUtfToUniChar(src, chPtr);
- if ((*chPtr & 0xFC00) == 0xD800) {
+ if ((*chPtr | 0x3FF) == 0xDBFF) {
/* A high surrogate character is detected, handle especially */
Tcl_UniChar low = *chPtr;
size_t len = (src <= srcEnd-3) ? Tcl_UtfToUniChar(src, &low) : 0;
- if ((low & 0xFC00) != 0xDC00) {
+ if ((low | 0x3FF) != 0xDFFF) {
*dst++ = (char) (((*chPtr >> 12) | 0xE0) & 0xEF);
*dst++ = (char) (((*chPtr >> 6) | 0x80) & 0xBF);
*dst++ = (char) ((*chPtr | 0x80) & 0xBF);