summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--generic/tclEncoding.c2
-rw-r--r--tests/encoding.test6
2 files changed, 7 insertions, 1 deletions
diff --git a/generic/tclEncoding.c b/generic/tclEncoding.c
index ecf01da..60abb51 100644
--- a/generic/tclEncoding.c
+++ b/generic/tclEncoding.c
@@ -2505,7 +2505,7 @@ Utf32ToUtfProc(
} else {
ch = (src[0] & 0xFF) << 24 | (src[1] & 0xFF) << 16 | (src[2] & 0xFF) << 8 | (src[3] & 0xFF);
}
- if (ch >= 0x10FFFF || (((flags & TCL_ENCODING_STRICT) == TCL_ENCODING_STRICT)
+ if ((unsigned)ch > 0x10FFFF || (((flags & TCL_ENCODING_STRICT) == TCL_ENCODING_STRICT)
&& !Tcl_UniCharIsUnicode(ch))) {
if (STOPONERROR) {
result = TCL_CONVERT_SYNTAX;
diff --git a/tests/encoding.test b/tests/encoding.test
index 24d9c82..a19357e 100644
--- a/tests/encoding.test
+++ b/tests/encoding.test
@@ -507,6 +507,12 @@ test encoding-17.7 {UtfToUtf16Proc} -body {
test encoding-17.8 {UtfToUtf16Proc} -body {
encoding convertto -strict utf-16le "\uD8D8"
} -returnCodes error -result {unexpected character at index 0: 'U+00D8D8'}
+test encoding-17.9 {Utf32ToUtfProc} -body {
+ encoding convertfrom -strict utf-32 "\xFF\xFF\xFF\xFF"
+} -returnCodes error -result {unexpected byte sequence starting at index 0: '\xFF'}
+test encoding-17.10 {Utf32ToUtfProc} -body {
+ encoding convertfrom -nocomplain utf-32 "\xFF\xFF\xFF\xFF"
+} -result \uFFFD
test encoding-18.1 {TableToUtfProc} {
} {}