diff options
author | Bill Holmes <bill.holmes@unity3d.com> | 2021-08-19 16:29:39 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-08-19 16:29:39 +0300 |
commit | e58be44d4729c237d0b148f63daf9dd78c0d1bd5 (patch) | |
tree | 54180612ca80c1f32419c767c81a7e06c50db4e2 /mono | |
parent | 20956cb3d84df213da894436630585691fe01630 (diff) |
Adding null check to avoid abort when invalid IL is encountered (#21194)
When a callvirt instruction is encountered on a static method, there is
a hard abort/crash. This commit avoids the problem.
Diffstat (limited to 'mono')
-rw-r--r-- | mono/mini/method-to-ir.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/mono/mini/method-to-ir.c b/mono/mini/method-to-ir.c index 068e0bbf9af..aec34bf2000 100644 --- a/mono/mini/method-to-ir.c +++ b/mono/mini/method-to-ir.c @@ -7458,7 +7458,7 @@ mono_method_to_ir (MonoCompile *cfg, MonoMethod *method, MonoBasicBlock *start_b sp -= n; - if (virtual_ && cmethod && sp [0]->opcode == OP_TYPED_OBJREF) { + if (virtual_ && cmethod && sp [0] && sp [0]->opcode == OP_TYPED_OBJREF) { ERROR_DECL (error); MonoMethod *new_cmethod = mono_class_get_virtual_method (sp [0]->klass, cmethod, FALSE, error); |