diff options
author | dkf <donal.k.fellows@manchester.ac.uk> | 2011-08-12 09:55:32 (GMT) |
---|---|---|
committer | dkf <donal.k.fellows@manchester.ac.uk> | 2011-08-12 09:55:32 (GMT) |
commit | c2c5a332c1228a18b01e4aa6fabcf7715ae3e4e2 (patch) | |
tree | 981d43d20fbf998c03ac000feca35fab23a0d6e4 /tests/zlib.test | |
parent | abfbf846faa6345835e2c79c057bec034f479b24 (diff) | |
download | tcl-c2c5a332c1228a18b01e4aa6fabcf7715ae3e4e2.zip tcl-c2c5a332c1228a18b01e4aa6fabcf7715ae3e4e2.tar.gz tcl-c2c5a332c1228a18b01e4aa6fabcf7715ae3e4e2.tar.bz2 |
[Bug 3390073]: Return the correct length of written data for a compressing
transform, ensuring that buffers are written exactly once instead of multiple
times or not at all (producing an invalid file).
Diffstat (limited to 'tests/zlib.test')
-rw-r--r-- | tests/zlib.test | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/tests/zlib.test b/tests/zlib.test index 47eeab8..dac11e4 100644 --- a/tests/zlib.test +++ b/tests/zlib.test @@ -156,6 +156,7 @@ test zlib-8.3 {zlib transformation and fileevent} -constraints zlib -setup { close $srv removeFile $file } -result 81920-->81920 + test zlib-9.1 "check fcopy with push" -constraints zlib -setup { set sfile [makeFile {} testsrc.gz] set file [makeFile {} test.gz] @@ -569,6 +570,37 @@ test zlib-10.2 "bug #2818131 (mismatch gets)" -constraints { rename bgerror {} rename zlibRead {} } -result {error {invalid block type}} + +test zlib-11.1 "Bug #3390073: mis-appled gzip filtering" -setup { + set file [makeFile {} test.input] +} -constraints zlib -body { + set f [open $file wb] + puts -nonewline [zlib push gzip $f] [string repeat "hello" 1000] + close $f + set f [open $file rb] + set d [read $f] + close $f + set d [zlib gunzip $d] + list [regexp -all "hello" $d] [string length [regsub -all "hello" $d {}]] +} -cleanup { + removeFile $file +} -result {1000 0} +test zlib-11.2 "Bug #3390073: mis-appled gzip filtering" -setup { + set file [makeFile {} test.input] +} -constraints zlib -body { + set f [open $file wb] + puts -nonewline [zlib push gzip $f -header {filename /foo/bar}] \ + [string repeat "hello" 1000] + close $f + set f [open $file rb] + set d [read $f] + close $f + set d [zlib gunzip $d -header h] + list [regexp -all "hello" $d] [dict get $h filename] \ + [string length [regsub -all "hello" $d {}]] +} -cleanup { + removeFile $file +} -result {1000 /foo/bar 0} ::tcltest::cleanupTests return |