summaryrefslogtreecommitdiffstats
path: root/win/tclWin32Dll.c
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2019-03-02 16:04:59 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2019-03-02 16:04:59 (GMT)
commita2ceb90c0d44ff21472b71ac79b96b577d3c967e (patch)
tree4a8907259172a0e3fb26c1592c5f5a9c9169d90c /win/tclWin32Dll.c
parente43dfb1f32c14c72a65cb0231694c2619b5ac1ff (diff)
downloadtcl-a2ceb90c0d44ff21472b71ac79b96b577d3c967e.zip
tcl-a2ceb90c0d44ff21472b71ac79b96b577d3c967e.tar.gz
tcl-a2ceb90c0d44ff21472b71ac79b96b577d3c967e.tar.bz2
Backport [bd94500678e837d7] from 8.7, preventing endless loops in UTF-8 conversions when handling surrogates. Only effective when compiling with -DTCL_UTF_MAX=4|6 (default: 3). Meant for benefit of Androwish.
Diffstat (limited to 'win/tclWin32Dll.c')
-rw-r--r--win/tclWin32Dll.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/win/tclWin32Dll.c b/win/tclWin32Dll.c
index 0fa86c9..c8bb98b 100644
--- a/win/tclWin32Dll.c
+++ b/win/tclWin32Dll.c
@@ -648,6 +648,10 @@ Tcl_WinTCharToUtf(
}
blen = Tcl_UniCharToUtf(*w, p);
p += blen;
+ if ((*w >= 0xD800) && (blen < 3)) {
+ /* Indication that high surrogate is handled */
+ blen = 0;
+ }
w++;
}
if (!blen) {