dsnet / compress

Collection of compression related Go packages.
BSD 3-Clause "New" or "Revised" License
405 stars 25 forks source link

xflate: behavior for reading past stream end #71

Closed Lupus closed 2 years ago

Lupus commented 2 years ago

Does xflate track the total size of uncompressed stream? Is it possible to read past the end of the stream somehow?

dsnet commented 2 years ago

Assuming that the input file is not corrupted or maliciously crafted, it is impossible to read past the end of the stream.

In section 2.1 of the specification, you can see that the index contains the total "raw" size. The "raw" size is the size of the uncompressed data.

Lupus commented 2 years ago

Great, thanks for confirming!