summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2017-06-02 08:17:26 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2017-06-02 08:17:26 (GMT)
commit630032a3be09b72dc60b0fcb41c346f11042ce41 (patch)
tree8c3f55d5f9a1ea064ef2ec59a55d82d255982b8c /tests
parent3ae95af52ca24414d723b827fc99cc1a2b94f778 (diff)
downloadtcl-630032a3be09b72dc60b0fcb41c346f11042ce41.zip
tcl-630032a3be09b72dc60b0fcb41c346f11042ce41.tar.gz
tcl-630032a3be09b72dc60b0fcb41c346f11042ce41.tar.bz2
Fix [67aa9a207037ae67f9014b544c3db34fa732f2dc|67aa9a2070]: Security: Invalid UTF-8 can inject unexpected characters
Diffstat (limited to 'tests')
-rw-r--r--tests/encoding.test25
1 files changed, 25 insertions, 0 deletions
diff --git a/tests/encoding.test b/tests/encoding.test
index 0374e2d..1d8bae5 100644
--- a/tests/encoding.test
+++ b/tests/encoding.test
@@ -448,6 +448,31 @@ test encoding-24.3 {EscapeFreeProc on open channels} {stdio} {
list $count [viewable $line]
} [list 3 "\u4e4e\u4e5e\u4e5f (\\u4e4e\\u4e5e\\u4e5f)"]
+test encoding-24.4 {Parse valid or invalid utf-8} {
+ string length [encoding convertfrom utf-8 "\xc0\x80"]
+} 1
+test encoding-24.5 {Parse valid or invalid utf-8} {
+ string length [encoding convertfrom utf-8 "\xc0\x81"]
+} 2
+test encoding-24.6 {Parse valid or invalid utf-8} {
+ string length [encoding convertfrom utf-8 "\xc1\xbf"]
+} 2
+test encoding-24.7 {Parse valid or invalid utf-8} {
+ string length [encoding convertfrom utf-8 "\xc2\x80"]
+} 1
+test encoding-24.8 {Parse valid or invalid utf-8} {
+ string length [encoding convertfrom utf-8 "\xe0\x80\x80"]
+} 3
+test encoding-24.9 {Parse valid or invalid utf-8} {
+ string length [encoding convertfrom utf-8 "\xe0\x9f\xbf"]
+} 3
+test encoding-24.10 {Parse valid or invalid utf-8} {
+ string length [encoding convertfrom utf-8 "\xe0\xa0\x80"]
+} 1
+test encoding-24.10 {Parse valid or invalid utf-8} {
+ string length [encoding convertfrom utf-8 "\xef\xbf\xbf"]
+} 1
+
file delete [file join [temporaryDirectory] iso2022.txt]
#