Skip to content
Tcl Source Code View Ticket
Login

View Ticket

2020-06-23
06:37
Added two tests demonstrating that the tickets [8af92dfb66] (bad stream expansion) and [f70ce1fead] ... check-in: 165b6516ea user: aku tags: zlib-chan-f70ce1fead
2020-04-16
05:46 • Closed ticket [8af92dfb66]: zlib transform issue, bad inflate plus 5 other c... artifact: b15232090a user: aku
05:45 • New ticket [f70ce1fead] zlib transform issue, multi-stream inflate ignores strea... artifact: adc768c168 user: aku
04:25 • Ticket [8af92dfb66] zlib transform issue, bad inflate status still Pending w... artifact: c19ecc4d12 user: aku
2020-04-15
19:14 • Pending ticket [8af92dfb66]. artifact: 142ee6b033 user: sebres
19:14 • Ticket [8af92dfb66]: 3 changes artifact: 16f84eccae user: sebres
19:06
fixes bug [8af92dfb66]: resolve too earlier stop of inflate's cycle (if generating decompressed data... check-in: 96e1e0251b user: sebres tags: core-8-6-branch
2020-04-14
20:06 • Ticket [8af92dfb66] zlib transform issue, bad inflate status still Open with... artifact: 3efb8c1f82 user: aku
20:06 • Add attachment example.deflated to ticket [8af92dfb66] artifact: 8950698e73 user: aku
20:04 • Add attachment example.tcl to ticket [8af92dfb66] artifact: 8cbe182ccc user: aku
20:03 • New ticket [8af92dfb66] zlib transform issue, bad inflate. artifact: ce39f2589d user: aku

zlib transform issue, bad inflate

Closed / Fixed8af92dfb668b292a7b21df9ac0418e3bc2e68befCreated 7 years agoUpdated 7 years ago
Descriptionwiki2020-04-14 20:03:17
I have an example file (591 bytes) where inflation using a channel transform generates a file which is 3096 bytes short of the actual file it was generated from by deflation. Using direct in-memory inflation OTOH is ok, i.e. reconstructs the input correctly (size, and sha256sum). I have not tried to use a stream object.

Example file and test script will be attached.

Output from the example run

  hephaistos:(529) ~/Play/CoreSources/B > tclsh example.tcl 
  ./example.direct:    458752
  ./example.transform: 455656
  Transform under by 3096, vs direct
I have seen this issue with 8.6.7 first, then confirmed to be still present in 8.6.10, and 8.7a4 (commit [c92d723731] on core-8-branch).
Referenced by2
  • 165b6516eaAdded two tests demonstrating that the tickets [8af92dfb66] (bad stream expansion) and [f70ce1fead] (multi-stream decoding without readahead limit shenanigans) are fixed. Verified that the tests fail with commit [4eb66645d6], just before the zlib fixes. Tweaked the zlib manpage paragraphs about -limit. Tweaked some code comments. Fixed typos in description of two unrelated zlib tests. check-in2020-06-23 06:37:59
  • 96e1e0251bfixes bug [8af92dfb66]: resolve too earlier stop of inflate's cycle (if generating decompressed data on flush case of full buffer) check-in2020-04-15 19:06:38
aku Ticket [8af92dfb66]: 3 changes [History diff]2020-04-14 20:06:51
sebreswiki2020-04-15 19:14:05

Check-in [96e1e0251b] fixes this, but...

The whole handling around ZlibTransformInput is very strange:

- ZlibTransformInput reads an input buffer for inflate in single bytes (where it can do that in larger chunks), so the internal cycle (e.g. callback execution) repeated toooooo many times;
- ResultGenerate/ResultCopy doing to many copy operations (ResultGenerate could decode to next (required) part of decompression buffer directly so ResultCopy could obtain the buffer without interim copy operations here and there.
- etc;

sebres Pending ticket [8af92dfb66]. [History diff]2020-04-15 19:14:23
akuwiki2020-04-16 04:25:21

I confirm that commit [96e1e0251b] fixes the ticket:

hephaistos:(510) ~/Play/CoreSources/B/tcl > tclsh ../example.tcl 
../example.direct:    458752
../example.transform: 458752
Match

... And `make test` passes.

akuplain2020-04-16 05:46:10
Followup: Ticket [f70ce1feadf55c2f0fd142bdc20fbdcae5698495].
Log in (anonymous is fine) to add a comment.

Attachments: