Skip to content

Commit

Permalink
fix: possible out of bounds slice access
Browse files Browse the repository at this point in the history
  • Loading branch information
plusvic committed Sep 6, 2023
1 parent 925695d commit 7641544
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions yara-x/src/re/fast/fastvm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -217,9 +217,11 @@ impl<'r> FastVM<'r> {
for position in &self.positions {
let jump_range =
*position..*position + step * jump as usize;
if memchr::memchr(0x0A, &input[jump_range]).is_none() {
next_positions
.insert(position + step * jump as usize);
if let Some(jump_range) = input.get(jump_range) {
if memchr::memchr(0x0A, jump_range).is_none() {
next_positions
.insert(position + step * jump as usize);
}
}
}
}
Expand Down

0 comments on commit 7641544

Please sign in to comment.