ostreedev / ostree-rs-ext

Rust library with higher level APIs on top of the core ostree API
Apache License 2.0
74 stars 24 forks source link

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

Closed travier closed 11 months ago

travier commented 11 months ago

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: https://github.com/coreos/rpm-ostree/issues/4646

travier commented 11 months ago

Note: Untested yet.

travier commented 11 months ago
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.

travier commented 11 months ago

Verified in https://github.com/travier/ostree-containers/pull/1 that this fixes this issue.