diff options
author | Zefram <zefram@fysh.org> | 2017-12-30 12:36:54 +0000 |
---|---|---|
committer | Zefram <zefram@fysh.org> | 2017-12-30 12:36:54 +0000 |
commit | dce3f5c3fd788f1c2e451e3760f05a347c949eff (patch) | |
tree | 34853724ee56bad73e6e3a48115ec33530b1f4d2 /pad.c | |
parent | e2bcc7d7ec67c661405135f9b00232631a97f2fb (diff) | |
download | perl-dce3f5c3fd788f1c2e451e3760f05a347c949eff.tar.gz |
assert nested CV existence when freeing CV
[perl #131631] has a convoluted test case that messes up parser error
recovery and causes a segv via null pointer dereference. Turn the segv
into an assertion failure, by asserting non-nullness of the pointer.
This doesn't fix the actual problem with error recovery.
Diffstat (limited to 'pad.c')
-rw-r--r-- | pad.c | 6 |
1 files changed, 4 insertions, 2 deletions
@@ -395,9 +395,11 @@ Perl_cv_undef_flags(pTHX_ CV *cv, U32 flags) if (name && PadnamePV(name) && *PadnamePV(name) == '&') { CV * const innercv = MUTABLE_CV(curpad[ix]); - U32 inner_rc = SvREFCNT(innercv); - assert(inner_rc); + U32 inner_rc; + assert(innercv); assert(SvTYPE(innercv) != SVt_PVFM); + inner_rc = SvREFCNT(innercv); + assert(inner_rc); if (SvREFCNT(comppad) < 2) { /* allow for /(?{ sub{} })/ */ curpad[ix] = NULL; |