|
2024-08-28
| ||
| 21:35 | Merge [bcac522a9f25d689]: "Test to demonstrate [9ee9f4d7be]. Not fixed." and "Check limits immediate... check-in: c5e7aac063 user: pooryorick tags: unchained, INCOMPATIBLE_LICENSE | |
|
2024-05-27
| ||
| 09:38 | • Ticket [9ee9f4d7be] zlib push/pop corrupts underlying channel status still O... artifact: 6e369bebf4 user: dkf | |
|
2024-05-25
| ||
| 13:54 | • Ticket [9ee9f4d7be]: 5 changes artifact: 5c22080554 user: dkf | |
| 13:53 | Test to demonstrate [9ee9f4d7be]. Not fixed. check-in: d5f4df948b user: dkf tags: core-8-6-branch | |
|
2020-06-19
| ||
| 20:04 | • Ticket [9ee9f4d7be] zlib push/pop corrupts underlying channel status still O... artifact: f246b8bbd2 user: aku | |
| 20:03 | • Ticket [9ee9f4d7be]: 3 changes artifact: b87fa89ec0 user: aku | |
| 20:00 | • Ticket [9ee9f4d7be]: 3 changes artifact: e6c825012b user: aku | |
|
2020-06-16
| ||
| 15:10 | • New ticket [9ee9f4d7be]. artifact: d26edead12 user: pooryorick | |
zlib push/pop corrupts underlying channel
set data hello
set src [file tempfile]
puts -nonewline $src $data
flush $src
chan configure $src -translation binary
set dst [file tempfile]
chan configure $dst -translation binary
for {set i 0} {$i < 10} {incr i} {
# Determine size of src channel
seek $src 0 end
set size [chan tell $src]
seek $src 0 start
# Determine size of content in src channel
set data [read $src]
set size2 [string length $data]
seek $src 0 start
# Copy src over to dst, keep dst empty
zlib push deflate $src -level 6
chan truncate $dst 0
chan copy $src $dst
chan pop $src
# Show sizes
puts [list $size $size2]
}
close $src
close $dst
#! /usr/bin/env tclsh
c5e7aac063Merge [bcac522a9f25d689]: "Test to demonstrate [9ee9f4d7be]. Not fixed." and "Check limits immediately when we do [interp eval]. [e3f4a8b78d]". check-in2024-08-28 21:35:59d5f4df948bTest to demonstrate [9ee9f4d7be]. Not fixed. check-in2024-05-25 13:53:52
This appears to be due to the compression header. For deflate that's two bytes. It's rather more for compress and gzip.
It's quite odd that you're compressing on reading data into Tcl. I wonder if that's related?
(This is now test zlib-14.1)
OK, the "problem" is that you're applying a compressor to a channel being read (a case we don't handle) yet the channel is really read-write so the flush on close (or pop) writes the header to it. Doing zlib push deflate creates a channel filter that activates on output.
I'm not quite sure what to do about this yet.