Skip to content

avm2: Improve error handling for verifier and supercalls, do typechecking in optimizer#21352

Merged
Lord-McSweeney merged 5 commits intoruffle-rs:masterfrom
Lord-McSweeney:avm2-binding-2
Aug 20, 2025
Merged

avm2: Improve error handling for verifier and supercalls, do typechecking in optimizer#21352
Lord-McSweeney merged 5 commits intoruffle-rs:masterfrom
Lord-McSweeney:avm2-binding-2

Conversation

@Lord-McSweeney
Copy link
Collaborator

We now throw a proper AVM error in many cases where we would've panicked before

@Lord-McSweeney Lord-McSweeney added A-avm2 Area: AVM2 (ActionScript 3) T-compat Type: Compatibility with Flash Player labels Aug 16, 2025
@Lord-McSweeney Lord-McSweeney force-pushed the avm2-binding-2 branch 2 times, most recently from f877ae2 to 6d8d5f0 Compare August 17, 2025 15:03
}
} else if let (Some(self_class), Some(other_class)) = (self.class, other.class) {
// Check for a common superclass.
// FIXME: Make this faster?
Copy link
Collaborator

@adrian17 adrian17 Aug 17, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

avmplus temporaraily sets a commonBase flag when iterating supers of the first type, then iterating the second type checks for the flag. It's kinda silly, but prevents a quadratic loop and should be doable here with a Cell<bool> too?

Not sure it'll even speed up the average case, but definitely prevent quadratic edge cases.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From what I can tell, 99.9% of the time that this branch is reached it's because of merging Number and int/uint, so this is usually very fast. I saw commonBase in avmplus too but it seems like a very hacky solution for almost no improvement (this branch is almost never hit).

I think it's fine to have this implemented this way, but if we care about the possibility of a SWF intentionally using a very long inheritance chain to break this, I can switch it over to the commonBase approach.

Copy link
Collaborator

@adrian17 adrian17 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you rename the PR please? Since it also extends the optimizer, making it possibly trigger more often

@Lord-McSweeney Lord-McSweeney changed the title avm2: Improve error handling for verifier and supercalls avm2: Improve error handling for verifier and supercalls, do typechecking in optimizer Aug 20, 2025
@Lord-McSweeney Lord-McSweeney merged commit e320980 into ruffle-rs:master Aug 20, 2025
24 checks passed
Comment on lines +510 to +511
// We don't need to validate the classes, as we already know that the
// `Object` and `Class` classes are valid

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry if this review is not expected.

I was wondering if this "we already know" should be made explicit using debug_assert!()?

Hancock33 added a commit to Hancock33/batocera.piboy that referenced this pull request Aug 24, 2025
--------------------------------------------------------------------------------------------------------
batocera-emulationstation.mk 4adf26b43900d1a33887af6d8af3da2e99e398a5 # Version: Commits on Aug 21, 2025
--------------------------------------------------------------------------------------------------------
Merge pull request #1962 from Tovarichtch/gamelistnameid

add some hypseus name ID,

------------------------------------------------------------------------------------------------
batocera-es-piboy.mk 4adf26b43900d1a33887af6d8af3da2e99e398a5 # Version: Commits on Aug 21, 2025
------------------------------------------------------------------------------------------------
Merge pull request #1962 from Tovarichtch/gamelistnameid

add some hypseus name ID,

---------------------------------------------------------------------------------------
amiberry.mk 2d7baaba741ba8bc7c41302bf20dedcb1d0c247d # Version: Commits on Aug 20, 2025
---------------------------------------------------------------------------------------
Update c-cpp.yml

Added builds for Debian trixie,

--------------------------------------------------------------------------------------------
amiberry-lite.mk 2efc21f2e928f59c7891ab1e8186fa61b141a1e5 # Version: Commits on Aug 20, 2025
--------------------------------------------------------------------------------------------
Merge pull request #25 from BlitterStudio/midwan-patch-1

Update c-cpp.yml,

----------------------------------------------------------------------------------
clk.mk 14e7ba8fab37c20677b3d8a062a143fc32926cf8 # Version: Commits on Aug 19, 2025
----------------------------------------------------------------------------------
Merge pull request #1535 from TomHarte/MDAStatus

Add MDA status register.,

------------------------------------------------------------------------------------------
dolphin-emu.mk 90a137ffdc96199c4e6105a4aadda30351a5ca75 # Version: Commits on Aug 20, 2025
------------------------------------------------------------------------------------------
Merge pull request #13888 from Sintendo/unused-psg

VideoCommon: Remove unused EnumMaps from PixelShaderGen,

------------------------------------------------------------------------------------------
duckstation.mk 6e926041e58e82e22c5aeaca65f34dd47d4d0da3 # Version: Commits on Aug 20, 2025
------------------------------------------------------------------------------------------
GPUDevice: Move options to create flags

And add prefer-GLES-context as a config setting, instead of

environment variable.,

--------------------------------------------------------------------------------------
flycast.mk 9c5408a6d3fff939ae06a319c2fce3aa6f2a4d69 # Version: Commits on Aug 20, 2025
--------------------------------------------------------------------------------------
macOS build fix

Work around brew change: Homebrew/brew#20414,

-------------------------------------------------------------------------------------
hatari.mk 6e6739f6e6c96a5a62109f52288aa409e76d5a36 # Version: Commits on Aug 19, 2025
-------------------------------------------------------------------------------------
Update VDI mode TOS v4 warning message,

-------------------------------------------------------------------------------------
ikemen.mk 65ec2dbe241935d4518b17a754f2b89e9c7f67f4 # Version: Commits on Aug 20, 2025
-------------------------------------------------------------------------------------
Merge pull request #2590 from SuperFromND/develop

feat: Remove \X/Y Truncate\,

--------------------------------------------------------------------------------------
openmsx.mk 295d2096a7163ef085893a5fa9b77fce82f23a33 # Version: Commits on Aug 20, 2025
--------------------------------------------------------------------------------------
Minor updates after review of Bart Bonamie.,

----------------------------------------------------
pcsx2.mk v2.5.117 # Version: Commits on Aug 20, 2025
----------------------------------------------------
- [GameDB: DQV Mount Evil camera fixes](PCSX2/pcsx2#13161)

-----------------------------------------------------------------------------------
play.mk 3c090f87220fede8b0e0435c414a314f26aefba9 # Version: Commits on Aug 20, 2025
-----------------------------------------------------------------------------------
CI: Use setup-xcode to set latest Xcode version.,

-------------------------------------------------------------------------------------
ppsspp.mk b4bd11137907407ccb5c52e00ae6701ea116404f # Version: Commits on Aug 21, 2025
-------------------------------------------------------------------------------------
Oops, left a test value behind in the frame rate check,

------------------------------------------------------------------------------------
rpcs3.mk d72f95677e92fd6031214d20861379ed005207a5 # Version: Commits on Aug 19, 2025
------------------------------------------------------------------------------------
overlays: add settings for screenshot and recording hints,

---------------------------------------------------------------
ruffle.mk nightly-2025-08-21 # Version: Commits on Aug 21, 2025
---------------------------------------------------------------
## What's Changed

* tests: Disable default font feature by default by @kjarosh in ruffle-rs/ruffle#21385

* avm2: Improve error handling for verifier and supercalls, do typechecking in optimizer by @Lord-McSweeney in ruffle-rs/ruffle#21352

**Full Changelog**: ruffle-rs/ruffle@nightly-2025-08-20...nightly-2025-08-21,

-----------------------------------------------------
ryujinx.mk 1.3.121 # Version: Commits on Aug 20, 2025
-----------------------------------------------------
Canary-1.3.121

-----------------------------------------------------------------------------------------
supermodel.mk 44280ae320a1ad4e1b8f72d714e97582d2b52989 # Version: Commits on Aug 19, 2025
-----------------------------------------------------------------------------------------
Pixels with alpha always seem to use the clamped light model. This includes textures with 1 bit alpha, as they will acquire some alpha after going after bilinear filtering. For these textures we only discard them if they are less than a specific threshold, but that leaves many opaque pixels that are technically opaque but with some alpha. This fixes some corner cases with the lighting in daytona.,

--------------------------------------------------------------------------------------------
supermodel-es.mk 55bfe6589c30152614d38ce33e4da3c83fad6106 # Version: Commits on Aug 19, 2025
--------------------------------------------------------------------------------------------
0.3a-44280ae,

---------------------------------------------------------------------------------------
thextech.mk 261c37ddf258d8080f776d50963aeabdddbcc2f7 # Version: Commits on Aug 21, 2025
---------------------------------------------------------------------------------------
Translated using Weblate (Russian)

Currently translated at 100.0% (680 of 680 strings)

Co-authored-by: Vitaly Novichkov <admin@wohlnet.ru>

Translate-URL: https://hosted.weblate.org/projects/thextech/engine-general/ru/

Translation: TheXTech Engine/Engine General,

--------------------------------------------------------------------------------------
tsugaru.mk 855bdc67114038b63c3350def08ecfe7b1152d95 # Version: Commits on Aug 19, 2025
--------------------------------------------------------------------------------------
Merge pull request #162 from rubin55/master

From termio.h to termios.h,

------------------------------------------------------------
xenia.mk v1.0.2825-master # Version: Commits on Aug 20, 2025
------------------------------------------------------------
Windows release build for xenia-project/xenia@01ae24e.

[Base/Memory] Fix VirtualQuery length parameter

,

-----------------------------------------------------------------------------------
ymir.mk f9056b738953be599fc177f394b6f7253ddc28c4 # Version: Commits on Aug 21, 2025
-----------------------------------------------------------------------------------
feat(app): Provide user feedback if any part of the app initialization fails,

-----------------------------------------------------------------------------------------
rpi-eeprom.mk 1793f5c4baa091941a8f85db756f6035c743ee5a # Version: Commits on Aug 21, 2025
-----------------------------------------------------------------------------------------
rpi-otp-private-key: Fix missing escape character in usage text,

----------------------------------------------------------------------------------------
rpi-utils.mk efe8351b61d116f7fedfcaf8ccfac8edb6a9f312 # Version: Commits on Aug 21, 2025
----------------------------------------------------------------------------------------
Merge pull request #142 from timg236/pubkey

rpifwcrypto: Add a pubkey API for deriving the public key for the device unique private key in OTP (ECDSA P-256),

--------------------------------------------------------------------
sound-open-firmware.mk v2025.05.1 # Version: Commits on Aug 19, 2025
--------------------------------------------------------------------
The release includes latest binaries of FW, tool and topology for all Intel released platforms. Following updates are included:

- SOF v2.13.1 DSP topologies.

- No change to other component (firmware binaries)

See https://github.com/thesofproject/sof/releases/tag/v2.13.1 source release notes.

Note: sof-bin releases currently only contain binaries for Intel SOF platforms. The release process is open to other vendors and future versions may include binaries for a larger set of hardware platforms.

### New DSP topologies added

For v2.13 series (Meteor Lake and newer), the following new topology files have been added since v2.13:

v2.13.x/sof-ipc4-tplg-v2.13.1

- sof-arl-cs42l43-l0-cs35l56-l2-2ch.tplg

- sof-arl-cs42l43-l2-cs35l56-l3-2ch.tplg

- sof-lnl-rt1320-l12-rt714-l0.tplg

- sof-ptl-es8336-ssp1.tplg

- sof-ptl-es83x6-ssp1-hdmi-ssp02.tplg

- sof-ptl-hdmi-ssp02.tplg

### Notes for distribution packagers

Please double-check you are including full contents of sof-bin to distribution packages. Since v2024.09, the package has started to contain separate module binaries for some of the platforms (e.g. /lib/firmware/intel/sof-ipc4-lib/ folder contains modules for Intel Lunar Lake based systems). These modules are loaded on demand if and when they are referred to by DSP topology files. In other words, please ship the full set of firmware binaries for a platform.

Modules are only used on systems where Linux kernel support is guaranteed to be in place. E.g. for Intel Lunar Lake, any kernel version that supports Lunar Lake has also support for SOF loadable modules. For older platforms, this is not necessarily the case, so sof-bin does not include modules for these platforms. See https://thesofproject.github.io/latest/developer_guides/firmware/llext_modules.html for more information about SOF loadable module support.

### Binary recipe

```

./tarball_multi_releases.bash -r 2025.05.1 v2.2.x/sof-v2.2 v2.2.x/tools-v2.2 v2.2.x/sof-tplg-v2.2.1 v2.2.x/sof-tplg-v2.2.3 v2.2.x/sof-tplg-v2.2.4 v2.2.x/sof-tplg-v2.2.5 v2.2.x/sof-tplg-v2.2.6 v2.2.x/sof-tplg-v2.2.7 v2.2.x/sof-tplg-v2.2.8 v2.2.x/sof-tplg-v2.2.9 v2.2.x/sof-tplg-v2.2.11 v2.2.x/sof-tplg-v2.2.12 v2.2.x/sof-tplg-v2.2.13 v2.12.x/sof-ipc4-v2.12 v2.13.x/sof-ipc4-tplg-v2.13 v2.13.x/sof-ipc4-tplg-v2.13.1 v2.13.x/sof-ipc4-v2.13 v2.13.x/sof-ipc4-lib-v2.13 v2.13.x/tools-v2.13

```

### Notes for older Intel platforms

For Intel products based on cAVS2.5 hardware (Tiger Lake, Alder Lake and Raptor Lake), this release provides multiple versions of firmware, SOF v2.12 for IPC4 DSP interface and SOF v2.2 for IPC3 DSP interface. IPC3/2.2 is still the default in upstream Linux for these platforms.

Please see the firmware version table at https://thesofproject.github.io/latest/getting_started/intel_debug/introduction.html#user-space-and-filesystem-requirements for reference.,

----------------------------------------------------------------------------------------
pironman5.mk 929c4f506e7e1a23b10ddd4391df2c0de23226a8 # Version: Commits on Aug 20, 2025
----------------------------------------------------------------------------------------
build: update version to 1.2.18 and add python3-dev dependency

Add python3-dev as an apt dependency to ensure proper build environment setup,

-----------------------------------------------------
pysdl3.mk v0.9.8b9 # Version: Commits on Aug 20, 2025
-----------------------------------------------------
-

--------------------------------------------------------------------------------------------
sf_rpi_status.mk 8ba7fd2a8e74c650e56b7b13b8351585cf1247e7 # Version: Commits on Aug 21, 2025
--------------------------------------------------------------------------------------------
feat(systemd): add service restart functionality and detection

Add new `restart_service` function to handle service restarts in different environments (Home Assistant addon or systemd service).

Introduce new `systemd_detector` module to detect if running as systemd service and retrieve service information.,

------------------------------------------------------------------------------------
box64.mk d476217f4c53ed5697086fd477cc4058e78fbae1 # Version: Commits on Aug 21, 2025
------------------------------------------------------------------------------------
[RV64_DYNAREC] Fixed more scalar avx opcodes (#2959)

* [RV64_DYNAREC] Fixed more scalar avx opcodes

* oops,

------------------------------------------------------------------------------------
cdogs.mk 7c1d0fe131034818aff29f0e1757503887affc08 # Version: Commits on Aug 21, 2025
------------------------------------------------------------------------------------
Fix crash when loading .cpn files (fixes #887),

------------------------------------------------------------------------------------------
devilutionx.mk 7d1aebd91be94ff20cbdeedaa3614548ab4dd33f # Version: Commits on Aug 14, 2025
------------------------------------------------------------------------------------------
Added support for mapping IDs for item types,

-------------------------------------------------------------------------------------------
jazz2-native.mk e1e08023637472fef3bf6107fd906334f6c8b1a3 # Version: Commits on Aug 21, 2025
-------------------------------------------------------------------------------------------
Fixed build,

----------------------------------------------------------------------------------------
openmohaa.mk 80b2e89dcc6e6fb993084fa8427edfc34aa32a58 # Version: Commits on Aug 19, 2025
----------------------------------------------------------------------------------------
Fix spelling errors,

-----------------------------------------------------------------------------------
rott.mk bb787453a7c37f7ffaeb77f864e0e9a26732934f # Version: Commits on Aug 21, 2025
-----------------------------------------------------------------------------------
run clang-format and dos2unix over all source files,

--------------------------------------------------------------------------------------
stalker.mk 381697b866fc68ef25aeec7e22cf480638d1837d # Version: Commits on Aug 21, 2025
--------------------------------------------------------------------------------------
Replace MK_CLSID macro with make_clsid constexpr function,

----------------------------------------------------------------------------------------
supertux2.mk 28d55c98e5035ca41680743eeb3ce6ba3f637360 # Version: Commits on Aug 21, 2025
----------------------------------------------------------------------------------------
Don't freeze on wait,

------------------------------------------------------------------------------------------------
libretro-mame-src.mk d7493bd0d1c255b35aef06f80977c13af2fa2bc0 # Version: Commits on Aug 20, 2025
------------------------------------------------------------------------------------------------
Merge remote-tracking branch 'upstream/master',

-----------------------------------------------------------------------------------------
winetricks.mk 73b92d2f3c117cd21d96e2fc807e041e7a89fec3 # Version: Commits on Apr 03, 2025
-----------------------------------------------------------------------------------------
sketchup: fix sha mismatch,

----------------------------------------------------------------------------------------------------
sdl2-gamecontrollerdb.mk 72da83a9a83d3dc4062cc49368486f5dfa449604 # Version: Commits on Aug 21, 2025
----------------------------------------------------------------------------------------------------
Fix broken link to SDL documentation (#878),

-----------------------------------------------------------------------------------
xone.mk dba215d6ef580b1895bb5ea94bcf800e1965b8be # Version: Commits on Aug 19, 2025
-----------------------------------------------------------------------------------
Fix reset on resume (#105),

----------------------------------------------------------------------------------------
retroarch.mk f7877df5788d096f5b2988768bf12f229b02d72d # Version: Commits on Aug 21, 2025
----------------------------------------------------------------------------------------
Extend autoconfig matching with a physical identifier (#18190),

----------------------------------------------------------------------------------------
doomretro.mk 00366a769ee980bb0da77f70804f1ab6eae39def # Version: Commits on Aug 20, 2025
----------------------------------------------------------------------------------------
Update to Visual Studio v17.14.13,

-----------------------------------------------------------------------------------
tr1x.mk c85309ce283558b5fb57d3404ac77cdbd3eda3bb # Version: Commits on Aug 20, 2025
-----------------------------------------------------------------------------------
tr2/console/cmd/winston: test object presence

This avoids a crash if trying to spawn Winston when the object

isn't loaded.,

-----------------------------------------------------------------------------------
tr2x.mk c85309ce283558b5fb57d3404ac77cdbd3eda3bb # Version: Commits on Aug 20, 2025
-----------------------------------------------------------------------------------
tr2/console/cmd/winston: test object presence

This avoids a crash if trying to spawn Winston when the object

isn't loaded.,

-----------------------------------------------------------------------------------------------
hlsdk-xash3d-dmc.mk 1d06c2a54b61794745d107711305a4c7e04623a9 # Version: Commits on Aug 19, 2025
-----------------------------------------------------------------------------------------------
Merge branch 'master' into dmc,

-------------------------------------------------------------------------------------------------
hlsdk-xash3d-opfor.mk a781ead2cc4680f84799f7536486cf9ee3338738 # Version: Commits on Aug 19, 2025
-------------------------------------------------------------------------------------------------
Merge branch 'opfor' into opforfixed,

---------------------------------------------------------------------------------------------------
hlsdk-xash3d-zombiex.mk c431cea986dde9da67f4f0f2170e43f7ab0fbfc9 # Version: Commits on Aug 19, 2025
---------------------------------------------------------------------------------------------------
Merge branch 'sohl1.2' into zombie-x,

--------------------------------------------------------------------------------------------------
libretro-clownmdemu.mk 06235521ff49855678982e936116b145286109e8 # Version: Commits on Aug 21, 2025
--------------------------------------------------------------------------------------------------
CI: Reference the correct Android scripts.,

---------------------------------------------------------------------------------------------
libretro-fbneo.mk 7345d0f50079ca989e3685152687f1ee15bad829 # Version: Commits on Aug 19, 2025
---------------------------------------------------------------------------------------------
(libretro) update files,

-----------------------------------------------------------------------------------------------
libretro-flycast.mk 9c5408a6d3fff939ae06a319c2fce3aa6f2a4d69 # Version: Commits on Aug 20, 2025
-----------------------------------------------------------------------------------------------
macOS build fix

Work around brew change: Homebrew/brew#20414,

-----------------------------------------------------------------------------------------------------
libretro-mame2003-plus.mk 3f778c3a06172f01a9ac6c08812f46bd0173187a # Version: Commits on Aug 20, 2025
-----------------------------------------------------------------------------------------------------
Add files via upload,

--------------------------------------------------------------------------------------------------------
libretro-mupen64plus-next.mk 222acbd3f98391458a047874d0372fe78e14fe94 # Version: Commits on Aug 20, 2025
--------------------------------------------------------------------------------------------------------
Add mediump precision specification for fragment shaders,

----------------------------------------------------------------------------------------------
libretro-ppsspp.mk b4bd11137907407ccb5c52e00ae6701ea116404f # Version: Commits on Aug 21, 2025
----------------------------------------------------------------------------------------------
Oops, left a test value behind in the frame rate check,

--------------------------------------------------------------------------------------------
libretro-puae.mk 9e2aa770a9b6b0a4e1f4fc05eb0db6c8e7aba8ee # Version: Commits on Aug 19, 2025
--------------------------------------------------------------------------------------------
Remove invalid audio hack hack,

------------------------------------------------------------------------------------------------
libretro-puae2021.mk a19f7423e8ac8bedf92023064589daf888340552 # Version: Commits on Aug 19, 2025
------------------------------------------------------------------------------------------------
Remove invalid audio hack hack,

----------------------------------------------------------------------------------------------
libretro-stella.mk 88eb24c8e61ce580c8c32eee692b182fe1536c3f # Version: Commits on Aug 21, 2025
----------------------------------------------------------------------------------------------
Fix 'double-escape' in InputTextDialog.

This fixes a bug when pressing Escape in the cheat code entry, the underlying dialog closes as well.

Also fixes a long-standing bug in the debugger 'Search RAM' dialog, where pressing Escape locks up the debugger.,

---------------------------------------------------------------------------------------------
libretro-vba-m.mk 967426e2f08ea89a89d12da641b9bb4ebd8559e3 # Version: Commits on Aug 21, 2025
---------------------------------------------------------------------------------------------
Fix color change with previous check,

---------------------------------------------------------------------------------------------
libretro-wasm4.mk ad76be395f6dc8d76b96505d60629dc481615ebf # Version: Commits on Aug 19, 2025
---------------------------------------------------------------------------------------------
Merge pull request #828 from yamt/toywasm-functype

wasm_toywasm.c: validate the type of callback functions,

-------------------------------------------------------------------------------------------
glsl-shaders.mk 2903be405926f473b270accf22cfb560af9cc54c # Version: Commits on Aug 21, 2025
-------------------------------------------------------------------------------------------
improve tiny-ntsc, remove 1 pass, more options, more authentic (#520)

* Improve tiny_ntsc.glsl

* Update tiny_ntsc.glslp

* Update tiny_ntsc.glsl,

--------------------------------------------------------------------------------------------
slang-shaders.mk e97ef5526d72835f12f298c1f255faf7703dfc01 # Version: Commits on Aug 21, 2025
--------------------------------------------------------------------------------------------
crt-beans: Add docs and delete extra files. (#729)

The include files were duplicated in an earlier commit.,
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-avm2 Area: AVM2 (ActionScript 3) T-compat Type: Compatibility with Flash Player

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants