In perl.git, the branch blead has been updated

<http://perl5.git.perl.org/perl.git/commitdiff/e39a63811f671c92ce10198aa285306911af500e?hp=52beaae7e855a9b9a072ca4d74a4fe12101aa915>

- Log -----------------------------------------------------------------
commit e39a63811f671c92ce10198aa285306911af500e
Author: David Mitchell <[email protected]>
Date:   Tue Mar 13 14:24:15 2012 +0000

    stop S_forget_pmop() SEGVing
    
    Commit 5bec93be re-purposed the SvMAGIC field of hashes being freed, on
    the grounds that (a) any magic had been freed, (b) the refcnt was zero, so
    no-one else could mess with the hash.
    
    Unfortunately in the non-threaded case, PMOPs for m?? regexes have a
    non-refcounted link back to their stash. When the stash is freed, any subs
    in the stash are freed, which frees the PMOPs, which then see the freed
    stash, and assume it still has magic because SvMAGIC is non-null.
    
    The quick fix is to check the SvMAGICAL flags first; a longer term fix
    would be to avoid the weak ref (e.g. by always using the threaded variant
    of PmopSTASH, which stores the stash's *name* rather than a pointer to the
    stash).
-----------------------------------------------------------------------

Summary of changes:
 op.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/op.c b/op.c
index cf3fec0..3bbe4f1 100644
--- a/op.c
+++ b/op.c
@@ -730,7 +730,7 @@ S_forget_pmop(pTHX_ PMOP *const o
 
     PERL_ARGS_ASSERT_FORGET_PMOP;
 
-    if (pmstash && !SvIS_FREED(pmstash)) {
+    if (pmstash && !SvIS_FREED(pmstash) && SvMAGICAL(pmstash)) {
        MAGIC * const mg = mg_find((const SV *)pmstash, PERL_MAGIC_symtab);
        if (mg) {
            PMOP **const array = (PMOP**) mg->mg_ptr;

--
Perl5 Master Repository

Reply via email to