diff options
author | dkf <donal.k.fellows@manchester.ac.uk> | 2010-09-15 22:11:59 (GMT) |
---|---|---|
committer | dkf <donal.k.fellows@manchester.ac.uk> | 2010-09-15 22:11:59 (GMT) |
commit | 555bbc4fc9ae1d18813578c9479915349bd81591 (patch) | |
tree | 90b78e5031bf8450c6b60d11a0d5357a48718853 /tests | |
parent | 049dfbc90f9aea5bc4cd4e02bc9cf4c774ea4f8a (diff) | |
download | tcl-555bbc4fc9ae1d18813578c9479915349bd81591.zip tcl-555bbc4fc9ae1d18813578c9479915349bd81591.tar.gz tcl-555bbc4fc9ae1d18813578c9479915349bd81591.tar.bz2 |
* generic/tclBinary.c (TclAppendBytesToByteArray): [Bug 3067036]: Make
sure we never try to double zero repeatedly to get a buffer size. Also
added a check for sanity on the size of buffer being appended.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/binary.test | 25 |
1 files changed, 23 insertions, 2 deletions
diff --git a/tests/binary.test b/tests/binary.test index c6b6941..79fdb92 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.40 2009/12/29 01:43:23 patthoyts Exp $ +# RCS: @(#) $Id: binary.test,v 1.41 2010/09/15 22:12:00 dkf Exp $ if {[lsearch [namespace children] ::tcltest] == -1} { package require tcltest @@ -76,7 +76,7 @@ proc testIEEE {} { } testConstraint ieeeFloatingPoint [testIEEE] - + # ---------------------------------------------------------------------- test binary-0.1 {DupByteArrayInternalRep} { @@ -2736,7 +2736,28 @@ test binary-75.26 {binary decode uuencode} -body { string length [binary decode uuencode " "] } -result 0 +test binary-76.1 {binary string appending growth algorithm} unix { + # Create zero-length byte array first + set f [open /dev/null rb] + chan configure $f -blocking 0 + set str [read $f 2] + close $f + # Append to it + string length [append str [binary format a* foo]] +} 3 +test binary-76.2 {binary string appending growth algorithm} win { + # Create zero-length byte array first + set f [open NUL rb] + chan configure $f -blocking 0 + set str [read $f 2] + close $f + # Append to it + string length [append str [binary format a* foo]] +} 3 + +# ---------------------------------------------------------------------- # cleanup + ::tcltest::cleanupTests return |