avm2: Add more ops that are guaranteed to not throw errors to `verify::ops_can_throw_error`
This requires a minor change to `Activation::op_lookup_switch`
This commit is contained in:
parent
6be4918d77
commit
f99c5621ee
|
@ -2834,7 +2834,11 @@ impl<'a, 'gc> Activation<'a, 'gc> {
|
|||
default_offset: i32,
|
||||
case_offsets: &[i32],
|
||||
) -> Result<FrameControl<'gc>, Error<'gc>> {
|
||||
let index = self.pop_stack().coerce_to_i32(self)?;
|
||||
let index = self.pop_stack().coerce_to_i32(self).map_err(|_| {
|
||||
Error::from(
|
||||
"VerifyError: Invalid value type on stack (should have been int) for LookupSwitch!",
|
||||
)
|
||||
})?;
|
||||
|
||||
let offset = case_offsets
|
||||
.get(index as usize)
|
||||
|
|
|
@ -794,7 +794,10 @@ fn optimize<'gc>(
|
|||
fn ops_can_throw_error(ops: &[AbcOp]) -> bool {
|
||||
for op in ops {
|
||||
match op {
|
||||
AbcOp::PushByte { .. }
|
||||
AbcOp::Bkpt
|
||||
| AbcOp::BkptLine { .. }
|
||||
| AbcOp::Timestamp
|
||||
| AbcOp::PushByte { .. }
|
||||
| AbcOp::PushDouble { .. }
|
||||
| AbcOp::PushFalse
|
||||
| AbcOp::PushInt { .. }
|
||||
|
@ -807,10 +810,23 @@ fn ops_can_throw_error(ops: &[AbcOp]) -> bool {
|
|||
| AbcOp::PushUint { .. }
|
||||
| AbcOp::PushUndefined
|
||||
| AbcOp::Dup
|
||||
| AbcOp::Swap
|
||||
| AbcOp::Pop
|
||||
| AbcOp::TypeOf
|
||||
| AbcOp::GetGlobalScope
|
||||
| AbcOp::GetScopeObject { .. }
|
||||
| AbcOp::GetOuterScope { .. }
|
||||
| AbcOp::GetGlobalSlot { .. }
|
||||
| AbcOp::GetLocal { .. }
|
||||
| AbcOp::SetLocal { .. }
|
||||
| AbcOp::Kill { .. }
|
||||
| AbcOp::Label
|
||||
| AbcOp::Jump { .. }
|
||||
| AbcOp::IfTrue { .. }
|
||||
| AbcOp::IfFalse { .. }
|
||||
| AbcOp::IfStrictEq { .. }
|
||||
| AbcOp::IfStrictNe { .. }
|
||||
| AbcOp::LookupSwitch { .. }
|
||||
| AbcOp::Nop
|
||||
| AbcOp::Not
|
||||
| AbcOp::PopScope
|
||||
|
|
Loading…
Reference in New Issue