summaryrefslogtreecommitdiffstats
path: root/tests/encoding.test
diff options
context:
space:
mode:
authorapnadkarni <apnmbx-wits@yahoo.com>2023-07-02 04:55:47 (GMT)
committerapnadkarni <apnmbx-wits@yahoo.com>2023-07-02 04:55:47 (GMT)
commit5dab0fa5de0367d41b4ad28b9a66c3cd1bf818ba (patch)
treef4371faf9fe8f11aac01c2da1309b63c532d906d /tests/encoding.test
parenta55934d7120943f45eee0c6283d093133905fc6d (diff)
downloadtcl-5dab0fa5de0367d41b4ad28b9a66c3cd1bf818ba.zip
tcl-5dab0fa5de0367d41b4ad28b9a66c3cd1bf818ba.tar.gz
tcl-5dab0fa5de0367d41b4ad28b9a66c3cd1bf818ba.tar.bz2
Backport fix [66ffafd309]. DBCS infinite loop on invalid encoding
Diffstat (limited to 'tests/encoding.test')
-rw-r--r--tests/encoding.test21
1 files changed, 21 insertions, 0 deletions
diff --git a/tests/encoding.test b/tests/encoding.test
index 4abc10e..8167357 100644
--- a/tests/encoding.test
+++ b/tests/encoding.test
@@ -1119,6 +1119,27 @@ test encoding-bug-6a3e2cb0f0-3 {Bug [6a3e2cb0f0] - invalid bytes in escape encod
encoding convertfrom -profile replace iso2022-jp x\x1b\x7aaby
} -result x\uFFFDy
+test encoding-bug-66ffafd309-1-tcl8 {Bug [66ffafd309] - truncated DBCS} -body {
+ encoding convertfrom -profile tcl8 gb12345 x
+} -result x
+test encoding-bug-66ffafd309-1-strict {Bug [66ffafd309] - truncated DBCS} -body {
+ encoding convertfrom -profile strict gb12345 x
+} -result {unexpected byte sequence starting at index 0: '\x78'} -returnCodes error
+test encoding-bug-66ffafd309-1-replace {Bug [66ffafd309] - truncated DBCS} -body {
+ encoding convertfrom -profile replace gb12345 x
+} -result \uFFFD
+test encoding-bug-66ffafd309-2-tcl8 {Bug [66ffafd309] - invalid DBCS} -body {
+ # Not truncated but invalid
+ encoding convertfrom -profile tcl8 jis0208 \x78\x79
+} -result \x78\x79
+test encoding-bug-66ffafd309-2-strict {Bug [66ffafd309] - invalid DBCS} -body {
+ # Not truncated but invalid
+ encoding convertfrom -profile strict jis0208 \x78\x79
+} -result {unexpected byte sequence starting at index 1: '\x79'} -returnCodes error
+test encoding-bug-66ffafd309-2-replace {Bug [66ffafd309] - invalid DBCS} -body {
+ # Not truncated but invalid
+ encoding convertfrom -profile replace jis0208 \x78\x79
+} -result \uFFFD\uFFFD
# cleanup
namespace delete ::tcl::test::encoding
::tcltest::cleanupTests