You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
While hunting a NullPointerException on the JVM backend I've stumbled upon a segfault on MoarVM. The nqp::backtrace() that is used to produce the segfault stems from src/core.c/CallFrame.pm6 -- it's actually used in sub callframe.
$ ./rakudo-m -e 'use nqp; my $bt := nqp::backtrace(nqp::handle(nqp::die(""),"CATCH",nqp::exception)); say nqp::elems($bt)'
11
$ ./rakudo-m -e 'use nqp; my $bt := nqp::backtrace(nqp::handle(nqp::die(""),"CATCH",nqp::exception)); say $bt[10]'
Segmentation fault (core dumped)
Looking a bit further, it turns out that the key sub in that last element of that backtrace contains a NULL:
$ ./rakudo-m -e 'use nqp; my $bt := nqp::backtrace(nqp::handle(nqp::die(""),"CATCH",nqp::exception)); my $sub := nqp::atkey(nqp::getattr($bt[10],Map,"\$!storage"),"sub"); dd nqp::isnull($sub)'
1
Doing a NULL check there and falling back to tc->instance->VMNull seems to avoid the segmentation fault. But I don't know if that would be the correct fix.
yes, it would.
usev6
added a commit
to usev6/MoarVM
that referenced
this issue
Apr 6, 2020
The Problem
While hunting a NullPointerException on the JVM backend I've stumbled upon a segfault on MoarVM. The
nqp::backtrace()
that is used to produce the segfault stems fromsrc/core.c/CallFrame.pm6
-- it's actually used insub callframe
.Looking a bit further, it turns out that the key
sub
in that last element of that backtrace contains a NULL:If I'm not mistaken this NULL comes from this line: https://github.com/MoarVM/MoarVM/blob/c7e75be60a/src/core/exceptions.c#L576. Doing a NULL check there and falling back to
tc->instance->VMNull
seems to avoid the segmentation fault. But I don't know if that would be the correct fix.Expected Behavior
Obviously, there should be no segfault. I'm not sure what the correct value for
sub
should be at that point.Compiler version (
perl6 -v
):The text was updated successfully, but these errors were encountered: