summaryrefslogtreecommitdiff
path: root/av.c
diff options
context:
space:
mode:
authorFather Chrysostomos <sprout@cpan.org>2013-11-03 04:47:17 -0800
committerFather Chrysostomos <sprout@cpan.org>2013-11-04 05:10:18 -0800
commit7274b33cb1232fb4911cb441bae8e0abebf734f2 (patch)
treed76bed36f2eb81d720f04346a3c5d2d92367f5fb /av.c
parentca58dfd9e0b19f1ae344f4aea62e3e4193f9c34f (diff)
downloadperl-7274b33cb1232fb4911cb441bae8e0abebf734f2.tar.gz
sub NEGATIVE_INDICES; + $tied[-1] = crash
This code in av.c, when trying to find $NEGATIVE_INDICES, was doing a direct stash element lookup--instead of going through the normal GV functions--and then expecting the returned value to be a GV. ‘sub NEGATIVE_INDICES’ creates a stash element that is a PV, not a GV, so it’s easy to make things crash.
Diffstat (limited to 'av.c')
-rw-r--r--av.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/av.c b/av.c
index 3473d08e6e..2a8ccf0de6 100644
--- a/av.c
+++ b/av.c
@@ -201,7 +201,8 @@ S_adjust_index(pTHX_ AV *av, const MAGIC *mg, SSize_t *keyp)
SV * const * const negative_indices_glob =
hv_fetchs(SvSTASH(SvRV(ref)), NEGATIVE_INDICES_VAR, 0);
- if (negative_indices_glob && SvTRUE(GvSV(*negative_indices_glob)))
+ if (negative_indices_glob && isGV(*negative_indices_glob)
+ && SvTRUE(GvSV(*negative_indices_glob)))
adjust_index = 0;
}
}