-
Notifications
You must be signed in to change notification settings - Fork 5.3k
Closed
Description
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:
runtime/src/mono/mono/mini/interp/interp.c
Lines 5580 to 5587 in eabea90
| 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