summaryrefslogtreecommitdiffstats
path: root/tests/zlib.test
diff options
context:
space:
mode:
authordkf <donal.k.fellows@manchester.ac.uk>2011-08-12 09:55:32 (GMT)
committerdkf <donal.k.fellows@manchester.ac.uk>2011-08-12 09:55:32 (GMT)
commit799b962aea1e21eb1d360a56a574b4bb57dd2853 (patch)
tree981d43d20fbf998c03ac000feca35fab23a0d6e4 /tests/zlib.test
parentba9424ed9813043dd8948d59a0fd5aa83b0cd0ca (diff)
downloadtcl-799b962aea1e21eb1d360a56a574b4bb57dd2853.zip
tcl-799b962aea1e21eb1d360a56a574b4bb57dd2853.tar.gz
tcl-799b962aea1e21eb1d360a56a574b4bb57dd2853.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.test32
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