Skip to content

[interp] inlining a wrapper with a MINT_LDSTR_TOKEN instruction aborts #88694

@lambdageek

Description

@lambdageek

If the runtime creates a wrapper whose entire body is just mono_mb_emit_exception_full(mb, "System", "NotImplementedException", "some case in this wrapper is unimplemented") then the interpreter will emit an MINT_LDSTR_TOKEN instruction for the const char* msg argument.

If this wrapper is then inlined into its caller, we end up here:

MonoMethod *method = frame->imethod->method;
if (method->wrapper_type == MONO_WRAPPER_DYNAMIC_METHOD) {
s = (MonoString*)mono_method_get_wrapper_data (method, strtoken);
} else if (method->wrapper_type != MONO_WRAPPER_NONE) {
// FIXME push/pop LMF
s = mono_string_new_wrapper_internal ((const char*)mono_method_get_wrapper_data (method, strtoken));
} else {
g_assert_not_reached ();

Normally, if the wrapper is not inlined MonoMethod *method = frame->imethod->method will be the wrapper, and we end up in the method->wrapper_type != MONO_WRAPPER_NONE case.

But if the wrapper is inlined we end up in the else g_assert_not_reached() case and crash.

Found in an early iteration of #88626

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions