Skip to content
This repository has been archived by the owner on Nov 7, 2024. It is now read-only.

chunking: Handle low amount of high-size packages #555

Merged
merged 1 commit into from
Oct 10, 2023

Conversation

travier
Copy link
Member

@travier travier commented Oct 9, 2023

If we have a low amount of high-size packages then we will drain with an index higher than the size of the Vec which triggers a panic.

Fixes: coreos/rpm-ostree#4646

@travier
Copy link
Member Author

travier commented Oct 9, 2023

Note: Untested yet.

@travier travier force-pushed the chunking-low-high-size branch 2 times, most recently from 5724349 to 70f918f Compare October 9, 2023 18:03
@travier
Copy link
Member Author

travier commented Oct 10, 2023

thread 'chunking::test::test_advanced_packing' panicked at 'assertion failed: high_size.len() < limit_hs_bins', lib/src/chunking.rs:470:5
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
Found file: var/foo
Found file: var/foo
Found file: var/lib/nested/foo
thread 'chunking::test::test_packing_fcos' panicked at 'assertion failed: high_size.len() < limit_hs_bins', lib/src/chunking.rs:470:5

Looks like this assert just found another off by one in my change.

If we have a low amount of high-size packages then we will drain with an
index higher than the size of the Vec which triggers a panic.

Fixes: coreos/rpm-ostree#4646
@travier travier force-pushed the chunking-low-high-size branch from 70f918f to c6e5aa7 Compare October 10, 2023 10:08
Copy link
Member

@cgwalters cgwalters left a comment

Choose a reason for hiding this comment

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

I think this makes sense...but man, we're going to need a lot more tests here.

@cgwalters cgwalters merged commit d70a9c9 into ostreedev:main Oct 10, 2023
8 checks passed
@travier
Copy link
Member Author

travier commented Oct 11, 2023

Verified in travier/ostree-containers#1 that this fixes this issue.

@travier travier deleted the chunking-low-high-size branch October 11, 2023 12:55
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Panic while composing an ostree container native image in container mode
2 participants