Skip to content

Commit

Permalink
avm2: Implement VerifyError 1078
Browse files Browse the repository at this point in the history
  • Loading branch information
Lord-McSweeney authored and Lord-McSweeney committed Dec 31, 2023
1 parent 77375ee commit e386b68
Showing 1 changed file with 26 additions and 1 deletion.
27 changes: 26 additions & 1 deletion core/src/avm2/verify.rs
Original file line number Diff line number Diff line change
Expand Up @@ -483,7 +483,7 @@ fn verify_block<'gc>(
}

// Ensure the global scope exists for these opcodes
Op::FindProperty { .. } | Op::FindPropStrict { .. } | Op::GetLex { .. } => {
Op::FindProperty { .. } | Op::FindPropStrict { .. } => {
// FP checks the scope that the function was defined in
// for freestanding functions. We can't do that easily,
// so just avoid this verification step for them.
Expand Down Expand Up @@ -525,6 +525,31 @@ fn verify_block<'gc>(
}
}

Op::GetLex { index } => {
// See comment for FindProperty/FindPropStrict.
if !method.is_function {
if body.init_scope_depth + current_scope_depth == 0 {
return Err(Error::AvmError(verify_error(
activation,
"Error #1013: Cannot call OP_findproperty when scopeDepth is 0.",
1013,
)?));
}
}

let multiname = method
.translation_unit()
.pool_maybe_uninitialized_multiname(*index, &mut activation.borrow_gc())?;

if multiname.has_lazy_component() {
return Err(Error::AvmError(verify_error(
activation,
"Error #1078: Illegal opcode/multiname combination.",
1078,
)?));
}
}

_ => {}
}
if let Some(end_idx) = end_idx {
Expand Down

0 comments on commit e386b68

Please sign in to comment.