summaryrefslogtreecommitdiffstats
path: root/generic/tclScan.c
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2019-02-18 20:48:59 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2019-02-18 20:48:59 (GMT)
commit2473a591bfbd5b346e1900e3c1088496b0d17590 (patch)
treed4351873a596cd351ae0f6ade2cdbc3ae732aec7 /generic/tclScan.c
parent52ed230e6f1f0f90a1ee63afa7a4d9948fd336ae (diff)
downloadtcl-2473a591bfbd5b346e1900e3c1088496b0d17590.zip
tcl-2473a591bfbd5b346e1900e3c1088496b0d17590.tar.gz
tcl-2473a591bfbd5b346e1900e3c1088496b0d17590.tar.bz2
Proposed fix for [bd94500678]: SEGFAULT by conversion of unicode (out of BMP) to byte-array.
Diffstat (limited to 'generic/tclScan.c')
-rw-r--r--generic/tclScan.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/generic/tclScan.c b/generic/tclScan.c
index fbfba2d..45035f1 100644
--- a/generic/tclScan.c
+++ b/generic/tclScan.c
@@ -882,8 +882,8 @@ Tcl_ScanObjCmd(
offset = TclUtfToUniChar(string, &sch);
i = (int)sch;
#if TCL_UTF_MAX == 4
- if (!offset) {
- offset = TclUtfToUniChar(string, &sch);
+ if ((offset == 1) && ((sch & 0xFC00) == 0xD800)) {
+ offset += TclUtfToUniChar(string+offset, &sch);
i = (((i<<10) & 0x0FFC00) + 0x10000) + (sch & 0x3FF);
}
#endif