Skip to content

Commit de558f9

Browse files
committed
Adding null check to avoid abort when invalid IL is encountered [case 1353003]
When a callvirt instruction is encountered on a static method, there is a hard abort/crash. This commit avoids the problem.
1 parent 7f8e521 commit de558f9

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

mono/mini/method-to-ir.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7456,7 +7456,7 @@ mono_method_to_ir (MonoCompile *cfg, MonoMethod *method, MonoBasicBlock *start_b
74567456

74577457
sp -= n;
74587458

7459-
if (virtual_ && cmethod && sp [0]->opcode == OP_TYPED_OBJREF) {
7459+
if (virtual_ && cmethod && sp[0] && sp [0]->opcode == OP_TYPED_OBJREF) {
74607460
ERROR_DECL (error);
74617461

74627462
MonoMethod *new_cmethod = mono_class_get_virtual_method (sp [0]->klass, cmethod, FALSE, error);

0 commit comments

Comments
 (0)