From 9ecc4c4119141bd3d334b9b2dc67d1b4bf9dab5b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexander=20Mei=C3=9Fner?= Date: Sat, 7 Dec 2024 22:16:41 +0000 Subject: [PATCH] Removes unnecessary debug mode arithmetic guard. --- src/interpreter.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) 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;