summaryrefslogtreecommitdiff
path: root/pp.c
diff options
context:
space:
mode:
authorFather Chrysostomos <sprout@cpan.org>2013-06-07 23:56:23 -0700
committerFather Chrysostomos <sprout@cpan.org>2013-06-08 00:14:12 -0700
commitdcdfe746ecfff81cc2793db4e7fdfe25be590e0b (patch)
tree3e7cdc9e93e36dc56dbe2306185d06e5e89c7cf1 /pp.c
parent94e7eb6fe4b29b1c1dbe5eb489b4bfae607d9350 (diff)
downloadperl-dcdfe746ecfff81cc2793db4e7fdfe25be590e0b.tar.gz
[perl #117941] Blessing into freed current stash
If the current stash has been freed, bless() with one argument will cause a crash when the object’s ‘stash’ is accessed. Simply disallow- ing this is the easiest fix.
Diffstat (limited to 'pp.c')
-rw-r--r--pp.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/pp.c b/pp.c
index 0367023506..e63c3422da 100644
--- a/pp.c
+++ b/pp.c
@@ -607,8 +607,12 @@ PP(pp_bless)
HV *stash;
if (MAXARG == 1)
+ {
curstash:
stash = CopSTASH(PL_curcop);
+ if (SvTYPE(stash) != SVt_PVHV)
+ Perl_croak(aTHX_ "Attempt to bless into a freed package");
+ }
else {
SV * const ssv = POPs;
STRLEN len;