Skip to content

Commit

Permalink
Fuzz added support for i64 and fix crash in fuzzing
Browse files Browse the repository at this point in the history
  • Loading branch information
sosthene-nitrokey committed Oct 2, 2024
1 parent c2c10d4 commit 6cf847e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
3 changes: 1 addition & 2 deletions fuzz/fuzz_targets/fuzz_target_1.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@ enum AllEnums {
U16(u16),
I32(i32),
U32(u32),
// Not implemented
// I64(i64),
I64(i64),
U64(u64),
Struct(Struct),
Array([Struct; 4]),
Expand Down
9 changes: 6 additions & 3 deletions src/de.rs
Original file line number Diff line number Diff line change
Expand Up @@ -229,9 +229,12 @@ impl<'de> Deserializer<'de> {
Ok(())
}

fn ignore_array(&mut self, major: u8, mult: u32) -> Result<()> {
let length = self.raw_deserialize_u32(major)?;
for _ in 0..length * mult {
fn ignore_array(&mut self, major: u8, mult: usize) -> Result<()> {
let length = self.raw_deserialize_u32(major)? as usize;
let Some(real_length) = length.checked_mul(mult) else {
return Err(Error::InexistentSliceToArrayError);
};
for _ in 0..real_length {
self.ignore()?;
}
Ok(())
Expand Down

0 comments on commit 6cf847e

Please sign in to comment.