Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[mono] Copy image data with AssemblyLoadContext.LoadFromStream #43592

Merged
merged 1 commit into from
Oct 21, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/mono/mono/metadata/appdomain.c
Original file line number Diff line number Diff line change
Expand Up @@ -2832,7 +2832,7 @@ mono_alc_load_raw_bytes (MonoAssemblyLoadContext *alc, guint8 *assembly_data, gu
{
MonoAssembly *ass = NULL;
MonoImageOpenStatus status;
MonoImage *image = mono_image_open_from_data_internal (alc, (char*)assembly_data, raw_assembly_len, FALSE, NULL, refonly, FALSE, NULL, NULL);
MonoImage *image = mono_image_open_from_data_internal (alc, (char*)assembly_data, raw_assembly_len, TRUE, NULL, refonly, FALSE, NULL, NULL);
Copy link
Member

Choose a reason for hiding this comment

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

not a big deal, but for non-ENABLE_NETCORE, this can be FALSE - ves_icall_System_AppDomain_LoadAssemblyRaw does its own memcpy.

(Ideally I'd like to see ves_icall_System_AppDomain_LoadAssemblyRaw not do its own copying - i'm pretty sure it leaks those bytes on assembly close. I think the managed array pinning it's doing is not necessary anymore under our newer conservative scanning rules for native code)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oh yeah, I can follow up with a PR to fix up non-netcore. I think I want to keep the backport to a one-liner.


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