From 0f2320565372960d2c8bb718cb2f03da6c0a6145 Mon Sep 17 00:00:00 2001 From: Lord-McSweeney <Lord-McSweeney@github.com> Date: Mon, 25 Mar 2024 18:17:03 -0700 Subject: [PATCH] avm2: Properly push coerced value back to stack in optimizer for Coerce op --- core/src/avm2/optimize.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/core/src/avm2/optimize.rs b/core/src/avm2/optimize.rs index 84b8a52490983..1e028b7ce1866 100644 --- a/core/src/avm2/optimize.rs +++ b/core/src/avm2/optimize.rs @@ -560,6 +560,8 @@ pub fn optimize<'gc>( } Op::Coerce { class } => { let stack_value = stack.pop_or_any(); + stack.push_class(*class); + if stack_value.guaranteed_null { // Coercing null to a non-primitive or void is a noop. if !GcCell::ptr_eq(*class, types.int.inner_class_definition())