Skip to content

Commit

Permalink
fix crashes reported by fuzz testing - avoid assert
Browse files Browse the repository at this point in the history
- avoid assert when parsing ilst item
  • Loading branch information
mindeng committed Jul 11, 2024
1 parent 9708993 commit 02d0a80
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/bbox/ilst.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,12 @@ impl IlstItem {
let (remain, (size, index, data_len, _, type_set, type_code, local)) =
tuple((be_u32, be_u32, be_u32, tag("data"), u8, be_u24, be_u32))(input)?;

assert_eq!(size - 24, data_len - 16);
if data_len < 16 {
if size < 24 || data_len < 16 {
context("invalid ilst item", fail::<_, (), _>)(remain)?;
}

// assert_eq!(size - 24, data_len - 16);
if size - 24 != data_len - 16 {
context("invalid ilst item", fail::<_, (), _>)(remain)?;
}

Expand Down

0 comments on commit 02d0a80

Please sign in to comment.