Skip to content

Commit

Permalink
RUST-1850 Fix a fuzzer failure (#460)
Browse files Browse the repository at this point in the history
  • Loading branch information
abr-egn authored Feb 21, 2024
1 parent 1f68823 commit 32f3dc3
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/de/raw.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1316,14 +1316,14 @@ impl<'de, 'a> CodeWithScopeDeserializer<'de, 'a> {
F: FnOnce(&mut Self) -> Result<O>,
{
let start_bytes = self.root_deserializer.bytes.bytes_read();
let out = f(self);
let out = f(self)?;
let bytes_read = self.root_deserializer.bytes.bytes_read() - start_bytes;
self.length_remaining -= bytes_read as i32;

if self.length_remaining < 0 {
return Err(Error::custom("length of CodeWithScope too short"));
}
out
Ok(out)
}
}

Expand Down

0 comments on commit 32f3dc3

Please sign in to comment.