-
Notifications
You must be signed in to change notification settings - Fork 159
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
fixing by adding max index computation in bitfield validation #1344
Conversation
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.
You could also add the offensive payload from Alex in a test:
#[test]
fn iter_last() {
// Create RLE with 2**64-2 set bits:
let rle: Vec<u8> = vec![0xE4, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x2F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x7F];
let (_bf, max) = BitField::from_bytes_with_max(&rle).unwrap();
assert_eq!(max, 18446744073709551614);
}
adacd00
to
cc3991f
Compare
idk how to close ur requested changes but... addressed! |
|
||
#[allow(clippy::absurd_extreme_comparisons)] | ||
if last_sector_number > MAX_SECTOR_NUMBER { | ||
if (last_sector_number as u64) > MAX_SECTOR_NUMBER { |
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.
You can have kept the type alias SectorNumber
here. But otherwise lgtm.
80d8cc3
to
0a64a7f
Compare
@laudiacay could you merge main into this when you get a chance? the clippy issues were fixed on main |
0a64a7f
to
873796b
Compare
Summary of changes
Changes introduced in this pull request:
Reference issue to close (if applicable)
no relevant issue
Other information and links
See audit slack channel. ready to review, but please please look over this closely! bitfields are easy places to mess up...