Skip to content

Commit 39adc83

Browse files
[mono] Copy image data with AssemblyLoadContext.LoadFromStream (#43593)
We don't actually pin the byte array, so it must be copied or it can be overwritten once we run a GC on the LOH. Fixes #43402 Tested manually that it fixes the issue using the associated repro. This isn't really something that lends itself to a test, so that's the best I can do. Co-authored-by: Ryan Lucia <rylucia@microsoft.com>
1 parent 46c9477 commit 39adc83

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/mono/mono/metadata/appdomain.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2821,7 +2821,7 @@ mono_alc_load_raw_bytes (MonoAssemblyLoadContext *alc, guint8 *assembly_data, gu
28212821
{
28222822
MonoAssembly *ass = NULL;
28232823
MonoImageOpenStatus status;
2824-
MonoImage *image = mono_image_open_from_data_internal (alc, (char*)assembly_data, raw_assembly_len, FALSE, NULL, refonly, FALSE, NULL, NULL);
2824+
MonoImage *image = mono_image_open_from_data_internal (alc, (char*)assembly_data, raw_assembly_len, TRUE, NULL, refonly, FALSE, NULL, NULL);
28252825

28262826
if (!image) {
28272827
mono_error_set_bad_image_by_name (error, "In memory assembly", "0x%p", assembly_data);

0 commit comments

Comments
 (0)