summaryrefslogtreecommitdiffstats
path: root/tests/binary.test
diff options
context:
space:
mode:
authorpatthoyts <patthoyts@users.sourceforge.net>2009-12-29 01:43:23 (GMT)
committerpatthoyts <patthoyts@users.sourceforge.net>2009-12-29 01:43:23 (GMT)
commit59172cf14f46e7f765d6bcce585b735629d1873f (patch)
tree7a0e77d1cddf3fbfe3946789b0f5f0701675eccf /tests/binary.test
parent4f253f35d890f5474c5652070916df0cee97a89b (diff)
downloadtcl-59172cf14f46e7f765d6bcce585b735629d1873f.zip
tcl-59172cf14f46e7f765d6bcce585b735629d1873f.tar.gz
tcl-59172cf14f46e7f765d6bcce585b735629d1873f.tar.bz2
Handle completely invalid input to the decode methods [Bug 2922555]
Diffstat (limited to 'tests/binary.test')
-rw-r--r--tests/binary.test21
1 files changed, 15 insertions, 6 deletions
diff --git a/tests/binary.test b/tests/binary.test
index c01cdde..c6b6941 100644
--- a/tests/binary.test
+++ b/tests/binary.test
@@ -10,7 +10,7 @@
# See the file "license.terms" for information on usage and redistribution of
# this file, and for a DISCLAIMER OF ALL WARRANTIES.
#
-# RCS: @(#) $Id: binary.test,v 1.39 2009/02/22 17:45:21 ferrieux Exp $
+# RCS: @(#) $Id: binary.test,v 1.40 2009/12/29 01:43:23 patthoyts Exp $
if {[lsearch [namespace children] ::tcltest] == -1} {
package require tcltest
@@ -2473,6 +2473,9 @@ test binary-71.9 {binary decode hex} -body {
set r [binary decode hex "6"]
list [string length $r] $r
} -result {0 {}}
+test binary-71.10 {binary decode hex} -body {
+ string length [binary decode hex " "]
+} -result 0
test binary-72.1 {binary encode base64} -body {
binary encode base64
@@ -2621,6 +2624,9 @@ test binary-73.23 {binary decode base64} -body {
set r [binary decode base64 YWJj]
list [string length $r] $r
} -result {3 abc}
+test binary-73.24 {binary decode base64} -body {
+ string length [binary decode base64 " "]
+} -result 0
test binary-74.1 {binary encode uuencode} -body {
binary encode uuencode
@@ -2668,19 +2674,19 @@ test binary-75.3 {binary decode uuencode} -body {
test binary-75.4 {binary decode uuencode} -body {
binary decode uuencode [string repeat "86)C" 20]
} -result [string repeat abc 20]
-test binary-75.5 {binary encode uuencode} -body {
+test binary-75.5 {binary decode uuencode} -body {
binary decode uuencode "``\$\"`P0``0(#"
} -result "\0\1\2\3\4\0\1\2\3"
-test binary-75.6 {binary encode uuencode} -body {
+test binary-75.6 {binary decode uuencode} -body {
string length [binary decode uuencode {`}]
} -result 0
-test binary-75.7 {binary encode uuencode} -body {
+test binary-75.7 {binary decode uuencode} -body {
string length [binary decode uuencode {``}]
} -result 1
-test binary-75.8 {binary encode uuencode} -body {
+test binary-75.8 {binary decode uuencode} -body {
string length [binary decode uuencode {```}]
} -result 2
-test binary-75.9 {binary encode uuencode} -body {
+test binary-75.9 {binary decode uuencode} -body {
string length [binary decode uuencode {````}]
} -result 3
test binary-75.10 {binary decode uuencode} -body {
@@ -2726,6 +2732,9 @@ test binary-75.25 {binary decode uuencode} -body {
set s "04)\#z"
binary decode uuencode $s
} -returnCodes error -match glob -result {invalid uuencode character "z" at position 4}
+test binary-75.26 {binary decode uuencode} -body {
+ string length [binary decode uuencode " "]
+} -result 0
# cleanup
::tcltest::cleanupTests