Skip to content

Commit

Permalink
Removes unnecessary debug mode arithmetic guard.
Browse files Browse the repository at this point in the history
  • Loading branch information
Lichtso committed Dec 7, 2024
1 parent e64598f commit 9ecc4c4
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/interpreter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,11 @@ macro_rules! check_pc {
($self:expr, $next_pc:ident, $target_pc:expr) => {
if ($target_pc as usize)
.checked_mul(ebpf::INSN_SIZE)
.and_then(|offset| $self.program.get(offset..offset + ebpf::INSN_SIZE))
.and_then(|offset| {
$self
.program
.get(offset..offset.saturating_add(ebpf::INSN_SIZE))
})
.is_some()
{
$next_pc = $target_pc;
Expand Down

0 comments on commit 9ecc4c4

Please sign in to comment.