-
-
Notifications
You must be signed in to change notification settings - Fork 415
fix[pack]: Don't decompress the delta when decompressing base objects. #2345
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
Conversation
It was already decompressed on line 285, so attempting to decompress it again turns the delta stream into garbage. Unfortunately I don't know enough about the git file format to make a test, the best I was able to do was to compare it to a reference implementation and see what was going wrong. Fixes GitoxideLabs#2344
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR fixes a buffer corruption bug in pack file delta resolution where decompressing a base object would overwrite already-decompressed delta instructions. The issue was discovered when attempting to read a specific object from the Chromium repository (issue #2344).
Key Changes
- Fixed buffer slice calculation when decompressing base objects to prevent corruption of delta instruction data
- The fix restricts decompression output to only the portion of the buffer designated for base object data, excluding the delta instructions area
|
Thanks so much for digging into this, and finding a solution. Just at a glance it makes perfect sense to bound the output buffer, to avoid the decompression to try to 'overshoot', which seems to happen now (with Admittedly, I couldn't try this against the …, and it succeeded. Beyond that, I think the test-suite would have caught it if this change was tuned to fixing exactly this one issue. |
|
And I have created a patch-release for |
Co-authored-by: Byron <[email protected]>
- Generated pack-regression-*.pack with large base object (52KB) and delta chains - Updated regression test to use custom pack file - Added comprehensive documentation explaining test limitations - Test exercises the buffer bounding code path even though it doesn't fail without the fix (requires specific zlib-rs compression conditions like chromium repository) - Provides infrastructure for adding reproducing pack file in the future Co-authored-by: Byron <[email protected]>
0.64.1 contains GitoxideLabs/gitoxide#2345, which fixes an issue where it throws an error when attempting to unpack objects.
0.64.1 contains GitoxideLabs/gitoxide#2345, which fixes an issue where it throws an error when attempting to unpack objects.
0.64.1 contains GitoxideLabs/gitoxide#2345, which fixes an issue where it throws an error when attempting to unpack objects.
It was already decompressed on line 285, so attempting to decompress it again turns the delta stream into garbage.
Unfortunately I don't know enough about the git file format to make a test, the best I was able to do was to compare it to a reference implementation and see what was going wrong.
Fixes #2344