Skip to content

Commit

Permalink
fix: fixed wrong check related to Span
Browse files Browse the repository at this point in the history
  • Loading branch information
nerodesu017 committed Dec 17, 2024
1 parent aa23a77 commit bc32af2
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/core/reader/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,9 @@ impl<'a> WasmReader<'a> {
/// [full_wasm_binary](WasmReader::full_wasm_binary), **if** the [Span]'s length is 0. For
/// further information, refer to the [field documentation of `pc`](WasmReader::pc).
pub fn move_start_to(&mut self, span: Span) -> Result<()> {
if span.from + span.len > self.full_wasm_binary.len() {
// Suppose we have from = 13 and len = 5 => 13,14,15,16,17
// If our whole file has only 17 bytes, this would throw an error if we wouldn't substract one
if span.from + span.len - 1 > self.full_wasm_binary.len() {
return Err(Error::Eof);
}

Expand Down

0 comments on commit bc32af2

Please sign in to comment.