Skip to content

Commit

Permalink
avm2: Prevent AVM1Movies from being moved around in the DO hierarchy
Browse files Browse the repository at this point in the history
  • Loading branch information
Lord-McSweeney authored and Lord-McSweeney committed Nov 30, 2023
1 parent 889c13f commit 1ce3ec6
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,14 @@ fn validate_add_operation<'gc>(
)?));
}

if !proposed_child.movie().is_action_script_3() {
return Err(Error::AvmError(argument_error(
activation,
"Error #2180: It is illegal to move AVM1 content (AS1 or AS2) to a different part of the displayList when it has been loaded into AVM2 (AS3) content.",
2180,
)?));
}

if DisplayObject::ptr_eq(proposed_child, new_parent) {
return Err(Error::AvmError(argument_error(
activation,
Expand Down
2 changes: 2 additions & 0 deletions tests/tests/swfs/avm2/mixed_avm/output.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,6 @@ hello from avm1!
[object AVM1Movie]
[object ApplicationDomain]
Load complete!
2180
ArgumentError
onmousedown at 10, 10!
Binary file modified tests/tests/swfs/avm2/mixed_avm/test.swf
Binary file not shown.

0 comments on commit 1ce3ec6

Please sign in to comment.