This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
In Perl_pv_escape(), avoid reading 1 byte beyond the end of the buffer.
[perl5.git] / gv.c
diff --git a/gv.c b/gv.c
index d22a439..a003adb 100644 (file)
--- a/gv.c
+++ b/gv.c
@@ -960,6 +960,7 @@ Perl_gv_stashpvn(pTHX_ const char *name, U32 namelen, I32 flags)
        return NULL;
     stash = GvHV(tmpgv);
     if (!(flags & ~GV_NOADD_MASK) && !stash) return NULL;
+    assert(stash);
     if (!HvNAME_get(stash)) {
        hv_name_set(stash, name, namelen, 0);
        
@@ -969,7 +970,6 @@ Perl_gv_stashpvn(pTHX_ const char *name, U32 namelen, I32 flags)
        if (HvAUX(GvSTASH(tmpgv))->xhv_name_count)
            mro_package_moved(stash, NULL, tmpgv, 1);
     }
-    assert(stash);
     return stash;
 }
 
@@ -1469,6 +1469,9 @@ Perl_gv_fetchpvn_flags(pTHX_ const char *nambeg, STRLEN full_len, I32 flags,
 #endif
            goto magicalize;
 
+       case '$':               /* $$ */
+           SvREADONLY_on(GvSVn(gv));
+           goto magicalize;
        case '!':               /* $! */
            GvMULTI_on(gv);
            /* If %! has been used, automatically load Errno.pm. */