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][aot] Avoid a crash if a method's signature cannot be loaded. #98997

Closed
wants to merge 1 commit into from
Closed
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
9 changes: 9 additions & 0 deletions src/mono/mono/mini/aot-compiler.c
Original file line number Diff line number Diff line change
Expand Up @@ -12949,6 +12949,7 @@ collect_methods (MonoAotCompile *acfg)
ERROR_DECL (error);
MonoMethod *method;
guint32 token = MONO_TOKEN_METHOD_DEF | (i + 1);
MonoMethodSignature *sig;

method = mono_get_method_checked (acfg->image, token, NULL, NULL, error);

Expand All @@ -12959,6 +12960,14 @@ collect_methods (MonoAotCompile *acfg)
return FALSE;
}

sig = mono_method_signature_checked (method, error);
if (!sig) {
aot_printerrf (acfg, "Failed to load method %s:%s from '%s' due to %s.\n", mono_class_full_name (method->klass), method->name, image->name, mono_error_get_message (error));
aot_printerrf (acfg, "Run with MONO_LOG_LEVEL=debug for more information.\n");
mono_error_cleanup (error);
return FALSE;
}

/* Load all methods eagerly to skip the slower lazy loading code */
mono_class_setup_methods (method->klass);

Expand Down
Loading