From c998be1b068916a8009a76867ed4eaed8938d19b Mon Sep 17 00:00:00 2001 From: dgp Date: Fri, 17 Apr 2020 04:45:26 +0000 Subject: When supporting 4-byte sequences, make sure the Overlong test does too, and make sure the test results reflect it. --- generic/tclUtf.c | 2 +- tests/utf.test | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/generic/tclUtf.c b/generic/tclUtf.c index fdf2e32..e637263 100644 --- a/generic/tclUtf.c +++ b/generic/tclUtf.c @@ -154,7 +154,7 @@ UtfCount( static CONST unsigned char overlong[3] = { 0x80, /* \xD0 -- all sequences valid */ 0xA0, /* \xE0\x80 through \xE0\x9F are invalid prefixes */ -#if TCL_UTF_MAX > 3 +#if TCL_UTF_MAX >= 3 0x90 /* \xF0\x80 through \xF0\x8F are invalid prefixes */ #else 0xC0 /* Not used, but reject all again for safety. */ diff --git a/tests/utf.test b/tests/utf.test index 2004625..e8b1d51 100644 --- a/tests/utf.test +++ b/tests/utf.test @@ -630,13 +630,13 @@ test utf-7.38 {Tcl_UtfPrev -- overlong sequence} testutfprev { } 1 test utf-7.39 {Tcl_UtfPrev -- overlong sequence} {testutfprev} { # Doesn't work with TCL_UTF_MAX>3 testutfprev A\xF0\x90\x80\x80 -} 4 +} 1 test utf-7.40 {Tcl_UtfPrev -- overlong sequence} {testutfprev} { # Doesn't work with TCL_UTF_MAX>3 testutfprev A\xF0\x90\x80\x80 4 -} 3 +} 1 test utf-7.41 {Tcl_UtfPrev -- overlong sequence} {testutfprev} { # Doesn't work with TCL_UTF_MAX>3 testutfprev A\xF0\x90\x80\x80 3 -} 2 +} 1 test utf-7.42 {Tcl_UtfPrev -- overlong sequence} testutfprev { testutfprev A\xF0\x90\x80\x80 2 } 1 -- cgit v0.12