(&mut self, target: usize, limit: usize)
| 114 | |
| 115 | #[inline] |
| 116 | pub(crate) fn checked_jump(&mut self, target: usize, limit: usize) -> Result<usize, VmErr> { |
| 117 | // Sandbox-off skips the budget decrement; the bounds check still runs. |
| 118 | if !self.sandbox_off { |
| 119 | if self.budget == 0 { return Err(cold_budget()); } |
| 120 | self.budget -= 1; |
| 121 | } |
| 122 | if target > limit { return Err(cold_runtime("jump target out of bounds")); } |
| 123 | Ok(target) |
| 124 | } |
| 125 | |
| 126 | pub(crate) fn str_to_char_vals(&mut self, s: &str) -> Result<Vec<Val>, VmErr> { |
| 127 | // Per-char heap allocs scale with input; charge the budget so loops over this stay bounded. |
no test coverage detected