summaryrefslogtreecommitdiff
path: root/gv.c
diff options
context:
space:
mode:
authorFather Chrysostomos <sprout@cpan.org>2013-11-02 06:17:23 -0700
committerFather Chrysostomos <sprout@cpan.org>2013-11-02 06:17:23 -0700
commit8bfda0d7d50f05de298abca907611be9a33d1626 (patch)
tree77cd1dc3647bb32094a31eda4b721dcd10938c1b /gv.c
parentcaa674f3cc1c9e05da7c41f3dffbea4b2640af3c (diff)
downloadperl-8bfda0d7d50f05de298abca907611be9a33d1626.tar.gz
Undefined lex sub used as inherited method crashes
Thanks to misuse of CvGV. $ perl5.19.5 -XMfeature=:all -e 'my sub foo {} undef &foo; *UNIVERSAL::bar = \&foo; main->bar()' Segmentation fault: 11 When deciding under which name to autoload the sub, we can’t assume CvGV(that_sub) is a GV, as it may be null.
Diffstat (limited to 'gv.c')
-rw-r--r--gv.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/gv.c b/gv.c
index e7ef9a7ec4..2b8812923b 100644
--- a/gv.c
+++ b/gv.c
@@ -1057,7 +1057,7 @@ Perl_gv_fetchmethod_pvn_flags(pTHX_ HV *stash, const char *name, const STRLEN le
GV* stubgv;
GV* autogv;
- if (CvANON(cv))
+ if (CvANON(cv) || !CvGV(cv))
stubgv = gv;
else {
stubgv = CvGV(cv);