Skip to content

Commit

Permalink
Switch to rfind
Browse files Browse the repository at this point in the history
We of course do not want to be triggered by "endobj" somewhere in the object.
  • Loading branch information
laurmaedje committed Oct 3, 2023
1 parent 4b78ca4 commit 6e82fae
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/renumber.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ fn extract_object(slice: &[u8]) -> Option<(i32, &[u8])> {
head += 1;
}

let mut tail = memchr::memmem::find(slice, b"endobj")?;
let mut tail = memchr::memmem::rfind(slice, b"endobj")?;
while tail > 0 && slice.get(tail - 1).copied().map_or(false, is_whitespace) {
tail -= 1;
}
Expand Down

0 comments on commit 6e82fae

Please sign in to comment.