diff options
author | apnadkarni <apnmbx-wits@yahoo.com> | 2023-06-29 11:30:51 (GMT) |
---|---|---|
committer | apnadkarni <apnmbx-wits@yahoo.com> | 2023-06-29 11:30:51 (GMT) |
commit | 13b2522d41f46ad72bf40fd0eda8937c20b27905 (patch) | |
tree | 629ab87c38743b1f5445fc8a49f035a6c19bfc90 | |
parent | 3a1e74ddc5de6f61eb41639166137552e480b08c (diff) | |
parent | 6ae93efff085e5d96d7e8e658ab64992e9e1191b (diff) | |
download | tcl-13b2522d41f46ad72bf40fd0eda8937c20b27905.zip tcl-13b2522d41f46ad72bf40fd0eda8937c20b27905.tar.gz tcl-13b2522d41f46ad72bf40fd0eda8937c20b27905.tar.bz2 |
Merge 8.7 - Bug [6a3e2cb0f0] - invalid bytes in escape encodings
-rw-r--r-- | generic/tclEncoding.c | 7 | ||||
-rw-r--r-- | tests/encoding.test | 9 |
2 files changed, 11 insertions, 5 deletions
diff --git a/generic/tclEncoding.c b/generic/tclEncoding.c index 3ab3de9..b02a422 100644 --- a/generic/tclEncoding.c +++ b/generic/tclEncoding.c @@ -4058,11 +4058,8 @@ EscapeToUtfProc( if ((checked == dataPtr->numSubTables + 2) || (flags & TCL_ENCODING_END)) { if (!PROFILE_STRICT(flags)) { - /* - * Skip the unknown escape sequence. TODO - bug? - * May be replace with UNICODE_REPLACE_CHAR? - */ - + /* Unknown escape sequence */ + dst += Tcl_UniCharToUtf(UNICODE_REPLACE_CHAR, dst); src += longest; continue; } diff --git a/tests/encoding.test b/tests/encoding.test index edca5f0..6220cb2 100644 --- a/tests/encoding.test +++ b/tests/encoding.test @@ -1162,6 +1162,15 @@ test encoding-30.3 {encoding convertfrom large strings > 4GB} -constraints { list [string length [set s [string repeat A 0x100000000]]] [string equal $s [encoding convertfrom ascii $s]] } -result {4294967296 1} +test encoding-bug-6a3e2cb0f0-1 {Bug [6a3e2cb0f0] - invalid bytes in escape encodings} -body { + encoding convertfrom -profile tcl8 iso2022-jp x\x1b\x7aaby +} -result x\uFFFDy +test encoding-bug-6a3e2cb0f0-2 {Bug [6a3e2cb0f0] - invalid bytes in escape encodings} -body { + encoding convertfrom -profile strict iso2022-jp x\x1b\x7aaby +} -returnCodes error -result {unexpected byte sequence starting at index 1: '\x1B'} +test encoding-bug-6a3e2cb0f0-3 {Bug [6a3e2cb0f0] - invalid bytes in escape encodings} -body { + encoding convertfrom -profile replace iso2022-jp x\x1b\x7aaby +} -result x\uFFFDy # cleanup namespace delete ::tcl::test::encoding |