diff --git a/src/interpreter.rs b/src/interpreter.rs index dcb38f5b..0a0edc95 100644 --- a/src/interpreter.rs +++ b/src/interpreter.rs @@ -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;