summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2021-03-02 10:38:36 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2021-03-02 10:38:36 (GMT)
commit895a4597bcd75eafbf2a22ee21b6dbd0e2252381 (patch)
tree1dcd4df8d3a0b99ef8cd69d73d7ba63403c2fea1
parent7c54d7ca1dbcfdbef7ada07a68beaaa734efbe2b (diff)
parentb697c844add273719e0d724f0e7680d215a0b163 (diff)
downloadtcl-895a4597bcd75eafbf2a22ee21b6dbd0e2252381.zip
tcl-895a4597bcd75eafbf2a22ee21b6dbd0e2252381.tar.gz
tcl-895a4597bcd75eafbf2a22ee21b6dbd0e2252381.tar.bz2
Merge 8.6
-rw-r--r--generic/tclUtf.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/generic/tclUtf.c b/generic/tclUtf.c
index 5db7343..e096c06 100644
--- a/generic/tclUtf.c
+++ b/generic/tclUtf.c
@@ -92,6 +92,8 @@ static const unsigned char complete[256] = {
#if TCL_UTF_MAX > 3
4,4,4,4,4,
#else
+ /* Tcl_UtfToUniChar() accesses src[1] and src[2] to check whether
+ * the UTF-8 sequence is valid, so we cannot use 1 here. */
3,3,3,3,3,
#endif
1,1,1,1,1,1,1,1,1,1,1
@@ -970,6 +972,10 @@ Tcl_UtfNext(
const char *next;
if (((*src) & 0xC0) == 0x80) {
+ /* Continuation byte, so we start 'inside' a (possible valid) UTF-8
+ * sequence. Since we are not allowed to access src[-1], we cannot
+ * check if the sequence is actually valid, the best we can do is
+ * just assume it is valid and locate the end. */
if ((((*++src) & 0xC0) == 0x80) && (((*++src) & 0xC0) == 0x80)) {
++src;
}