Skip to content

Commit 6c7e72d

Browse files
[mono] Fix a crash during stack trace construction if a this object is null. (#21488)
Fixes dotnet#67354. Co-authored-by: Bill Holmes <[email protected]>
1 parent dffa5ab commit 6c7e72d

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

mono/mini/mini-exceptions.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -840,7 +840,7 @@ get_generic_info_from_stack_frame (MonoJitInfo *ji, MonoContext *ctx)
840840
/* Avoid returning a managed object */
841841
MonoObject *this_obj = (MonoObject *)info;
842842

843-
return this_obj->vtable;
843+
return this_obj ? this_obj->vtable : NULL;
844844
}
845845
}
846846

@@ -901,7 +901,7 @@ get_method_from_stack_frame (MonoJitInfo *ji, gpointer generic_info)
901901
MonoGenericContext context;
902902
MonoMethod *method;
903903

904-
if (!ji->has_generic_jit_info || !mono_jit_info_get_generic_jit_info (ji)->has_this)
904+
if (!ji->has_generic_jit_info || !mono_jit_info_get_generic_jit_info (ji)->has_this || !generic_info)
905905
return jinfo_get_method (ji);
906906
context = mono_get_generic_context_from_stack_frame (ji, generic_info);
907907

0 commit comments

Comments
 (0)