summaryrefslogtreecommitdiff
path: root/proto.h
diff options
context:
space:
mode:
authorDavid Mitchell <davem@iabyn.com>2015-03-13 11:18:38 +0000
committerDavid Mitchell <davem@iabyn.com>2015-03-13 12:26:55 +0000
commitdc3c1c7079dd7767e3d45a651b4fac4a932d25ed (patch)
tree1970b116de66584e44f97dbe74ec597d3b35937e /proto.h
parentd210e52092d500e8dcb8c96cb522a103fab67aef (diff)
downloadperl-dc3c1c7079dd7767e3d45a651b4fac4a932d25ed.tar.gz
Perl_multideref_stringify: don't SEGV on null cv
This function is called by e.g. "perl -Dt" to display the multideref op: $ perl -Dt -e'$a->{foo}[1]' ... (-e:1) multideref($a->{"foo"}[1]) On threaded builds, it needs to know the correct pad (and so the correct cv too) so that it can access GVs and const SVs that have been moved to the pad. However with a sort code block (rather than a sort sub), S_deb_curcv() returns null, so multideref_stringify() is called with a null CV. This then SEGVs. Although ideally S_deb_curcv() should be fixed, a function like multideref_stringify(), which can be used for debugging, should be robust in unexpected circumstances. So this commit makes it safe (although not particularly useful) with a null CV: $ perl -Dt -e'@a = sort { $a->[$i] <=> $b->[$i] } [0], [1]' ... (-e:1) sort (-e:1) multideref(<NULLGV>->[<NULLGV>]) (-e:1) multideref(<NULLGV>->[<NULLGV>])
Diffstat (limited to 'proto.h')
-rw-r--r--proto.h5
1 files changed, 2 insertions, 3 deletions
diff --git a/proto.h b/proto.h
index af9648ef23..aa43b9504f 100644
--- a/proto.h
+++ b/proto.h
@@ -2770,10 +2770,9 @@ PERL_CALLCONV SV* Perl_mro_set_private_data(pTHX_ struct mro_meta *const smeta,
assert(smeta); assert(which); assert(data)
PERL_CALLCONV SV* Perl_multideref_stringify(pTHX_ const OP* o, CV *cv)
- __attribute__nonnull__(pTHX_1)
- __attribute__nonnull__(pTHX_2);
+ __attribute__nonnull__(pTHX_1);
#define PERL_ARGS_ASSERT_MULTIDEREF_STRINGIFY \
- assert(o); assert(cv)
+ assert(o)
PERL_CALLCONV NV Perl_my_atof(pTHX_ const char *s)
__attribute__nonnull__(pTHX_1);