Skip to content

Commit ad72f05

Browse files
Lord-McSweeneyLord-McSweeney
Lord-McSweeney
authored andcommitted
core: Prevent AVM1 movies loaded by AVM2 from loading over themselves
1 parent c5a4eee commit ad72f05

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

core/src/loader.rs

+20
Original file line numberDiff line numberDiff line change
@@ -332,6 +332,26 @@ impl<'gc> LoadManager<'gc> {
332332
loader_url: Option<String>,
333333
vm_data: MovieLoaderVMData<'gc>,
334334
) -> OwnedFuture<(), Error> {
335+
// When an AVM2 movie loads an AVM1 movie, that AVM1 movie cannot load
336+
// another movie over itself, as in loadMovie(..., _root). Attempts to
337+
// do so will be silently ignored.
338+
//
339+
// However, if the AVM1 movie uses MovieClipLoader.loadClip to load into
340+
// its _root, FP32 will segfault. We don't reproduce that behavior.
341+
if matches!(vm_data, MovieLoaderVMData::Avm1 { .. }) {
342+
// This check works because the only time AVM1 can access an MC with
343+
// `loader_info` set is when that MC is the root MC of an AVM1 movie
344+
// that was loaded by AVM2
345+
if target_clip
346+
.as_movie_clip()
347+
.and_then(|mc| mc.loader_info())
348+
.is_some()
349+
{
350+
// Return a future that does nothing
351+
return Box::pin(async move { Ok(()) });
352+
}
353+
}
354+
335355
let loader = Loader::Movie {
336356
self_handle: None,
337357
target_clip,

0 commit comments

Comments
 (0)