Skip to content

Commit

Permalink
Disable CRC checks for fuzzing builds
Browse files Browse the repository at this point in the history
  • Loading branch information
cry-inc committed Apr 2, 2024
1 parent 72441e9 commit 64cd212
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/paged_reader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -109,16 +109,17 @@ impl<T: Read + Seek> PagedReader<T> {
// now everybody has to swap bytes as well because it was not noticed back then :)
let calculated_checksum = crc.to_be_bytes();

#[cfg(not(fuzzing))]
if expected_checksum != calculated_checksum {
self.page_num = None;
Err(Error::new(
return Err(Error::new(
ErrorKind::InvalidData,
format!("Detected invalid checksum (expected: {expected_checksum:?}, actual: {calculated_checksum:?}) for page {page}")
))
} else {
self.page_num = Some(page);
Ok(())
));
}

self.page_num = Some(page);
Ok(())
}

/// Do some skipping to next 4-byte-aligned offset, if needed.
Expand Down

0 comments on commit 64cd212

Please sign in to comment.