fix: cap aggregate delta data allocation in gix-pack#2632
Merged
Conversation
A ClusterFuzz data_file testcase could build a malformed delta chain whose individual entry sizes stayed below the configured fuzz allocation cap, but whose aggregate decompressed delta payload size reached multi-gigabyte scale. The fuzz harness then attempted to reserve that aggregate buffer and aborted with libFuzzer out-of-memory. Reject aggregate delta payload sizes once they exceed File::with_alloc_limit_bytes(), matching the existing protection for individual decoded object sizes. Add the minimized ClusterFuzz testcase to the data_file artefacts so the known input remains available to the fuzz target and artifact smoke test. Co-authored-by: Sebastian Thiel <sebastian.thiel@icloud.com>
b1fa4b0 to
6de909b
Compare
There was a problem hiding this comment.
Pull request overview
Adds an aggregate allocation cap during delta-chain walking in gix-pack, preventing OOM when many individually-small delta payloads sum to multi-gigabyte allocations. Mirrors the existing per-entry alloc_limit_bytes check.
Changes:
- After summing each delta's
decompressed_sizeintototal_delta_data_size, reject the chain if the running total exceedsalloc_limit_bytes.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Tasks
Created by Codex on behalf of Byron. Byron will review before this is ready to merge.
Summary
This fixes a
gix-packdata_filefuzz out-of-memory failure caused by a malformed delta chain whose individual delta sizes stayed under the configured fuzz allocation cap while the aggregate delta payload buffer grew to multi-gigabyte scale.The fix rejects aggregate delta payload sizes once they exceed
File::with_alloc_limit_bytes(), matching the existing protection for individual decoded object sizes. The minimized ClusterFuzz testcase was added togix-pack/fuzz/artifacts/data_file/as an artefact.Reported issue
Validation
env -u http_proxy -u https_proxy -u all_proxy -u HTTP_PROXY -u HTTPS_PROXY -u ALL_PROXY cargo +nightly fuzz run --fuzz-dir gix-pack/fuzz data_file gix-pack/fuzz/artifacts/data_file/clusterfuzz-testcase-minimized-gix-pack-data_file-5840107382046720 -- -runs=1cargo test -p gix-pack fuzzedNotes
I left the integration test behavior unchanged after follow-up instruction; the new artefact is available to the fuzz target and the existing artifact smoke test.