avm2: Create bad branch errors lazily in verifier

This commit is contained in:
Lord-McSweeney 2024-05-04 13:56:16 -07:00 committed by Lord-McSweeney
parent 4df7722aab
commit 8ab19054aa
1 changed files with 2 additions and 2 deletions

View File

@ -506,7 +506,7 @@ pub fn verify_method<'gc>(
let mut byte_offset = idx_to_byte_offset let mut byte_offset = idx_to_byte_offset
.get(i as usize) .get(i as usize)
.copied() .copied()
.ok_or(make_error_1021(activation))?; // This is still reachable with some weird bytecode, see the `verify_jump_to_middle_of_op` test .ok_or_else(|| make_error_1021(activation))?; // This is still reachable with some weird bytecode, see the `verify_jump_to_middle_of_op` test
if is_jump { if is_jump {
byte_offset += JUMP_INSTRUCTION_LENGTH; byte_offset += JUMP_INSTRUCTION_LENGTH;
@ -516,7 +516,7 @@ pub fn verify_method<'gc>(
let new_idx = byte_offset_to_idx let new_idx = byte_offset_to_idx
.get(&(new_byte_offset as usize)) .get(&(new_byte_offset as usize))
.copied() .copied()
.ok_or(make_error_1021(activation))?; // See above comment .ok_or_else(|| make_error_1021(activation))?; // See above comment
Ok((new_idx, new_idx - i - 1)) Ok((new_idx, new_idx - i - 1))
}; };