avm2: Properly verify constant pool lookups for `Op::Coerce` and `Op::AsType`
This commit is contained in:
parent
442391ea60
commit
fcf83d7dd9
|
@ -487,9 +487,9 @@ fn verify_code_starting_from<'gc>(
|
||||||
| AbcOp::Coerce { index: name_index } => {
|
| AbcOp::Coerce { index: name_index } => {
|
||||||
let multiname = method
|
let multiname = method
|
||||||
.translation_unit()
|
.translation_unit()
|
||||||
.pool_maybe_uninitialized_multiname(*name_index, &mut activation.context)
|
.pool_maybe_uninitialized_multiname(*name_index, &mut activation.context);
|
||||||
.unwrap();
|
|
||||||
|
|
||||||
|
if let Ok(multiname) = multiname {
|
||||||
if multiname.has_lazy_component() {
|
if multiname.has_lazy_component() {
|
||||||
// This matches FP's error message
|
// This matches FP's error message
|
||||||
return Err(Error::AvmError(verify_error(
|
return Err(Error::AvmError(verify_error(
|
||||||
|
@ -508,13 +508,21 @@ fn verify_code_starting_from<'gc>(
|
||||||
activation,
|
activation,
|
||||||
&format!(
|
&format!(
|
||||||
"Error #1014: Class {} could not be found.",
|
"Error #1014: Class {} could not be found.",
|
||||||
multiname.to_qualified_name(activation.context.gc_context)
|
multiname
|
||||||
|
.to_qualified_name(activation.context.gc_context)
|
||||||
),
|
),
|
||||||
1014,
|
1014,
|
||||||
)
|
)
|
||||||
.expect("Error should construct"),
|
.expect("Error should construct"),
|
||||||
)
|
)
|
||||||
})?;
|
})?;
|
||||||
|
} else {
|
||||||
|
return Err(Error::AvmError(verify_error(
|
||||||
|
activation,
|
||||||
|
&format!("Error #1032: Cpool index {} is out of range.", name_index.0),
|
||||||
|
1032,
|
||||||
|
)?));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
_ => {}
|
_ => {}
|
||||||
|
|
Loading…
Reference in New Issue