Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix large file decompression bug #40

Merged
merged 5 commits into from
Apr 16, 2024

Conversation

BorisOrca
Copy link
Contributor

@BorisOrca BorisOrca commented Apr 15, 2024

Checklist

  • Pull request details were added to CHANGELOG.rst
  • Documentation was updated (if needed)

The ISIZE field is specified to hold the size the original (uncompressed) file modulo 2^32 (since there are only 32 bits available for this field). This means that when a file larger than 4GB is compressed, ISIZE does not actually hold the file size. However, when handling the gzip trailer, the code compares the total output size with the ISIZE field directly (without truncating higher order bits), which only works if size_t (as the data type that is used to hold the total_out variable) is also 32 bits long, which is not the case in general.

@BorisOrca BorisOrca changed the title Fix decompression bug with large files Fix large file decompression bug Apr 15, 2024
Copy link
Contributor

@rhpvorderman rhpvorderman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for bringing this to my attention!
On another library where I work on, pyton-isal, the ISA-L struct uses a uint32_t integer by design. I didn't properly check if this was the case for zlib-ng. My bad.

I have some minor comments. If you could address these I will make a new release ASAP.

src/zlib_ng/zlib_ngmodule.c Outdated Show resolved Hide resolved
src/zlib_ng/zlib_ngmodule.c Outdated Show resolved Hide resolved
tests/test_gzip_ng.py Outdated Show resolved Hide resolved
tests/test_gzip_ng.py Outdated Show resolved Hide resolved
@BorisOrca
Copy link
Contributor Author

Thanks a lot for your comments! Updated the PR accordingly.

@rhpvorderman rhpvorderman merged commit c124c58 into pycompression:develop Apr 16, 2024
19 checks passed
@rhpvorderman
Copy link
Contributor

Release binaries are being build now. Thanks a lot for the fix!

@BorisOrca BorisOrca deleted the fix-isize-check branch April 21, 2024 08:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants