This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
pad.c:pad_reset: check the name
authorFather Chrysostomos <sprout@cpan.org>
Sun, 12 Jan 2014 01:02:32 +0000 (17:02 -0800)
committerFather Chrysostomos <sprout@cpan.org>
Thu, 28 Aug 2014 20:04:16 +0000 (13:04 -0700)
This code was sufficiently out-of-date to trip assertions in miniperl,
breaking the build (with -Accflags=-DUSE_BROKEN_PAD_RESET).

We can’t SvPADTMP_off on just anything, because it asserts that the
thing is !SvPADMY.

So check that it has no name first.  A pad entry without a name is an
operator target (or an unallocated entry).

The build is still broken, but it gets a bit further.

pad.c

diff --git a/pad.c b/pad.c
index 00ba632..acbaae1 100644 (file)
--- a/pad.c
+++ b/pad.c
@@ -1660,7 +1660,10 @@ S_pad_reset(pTHX)
     if (!TAINTING_get) {       /* Can't mix tainted and non-tainted temporaries. */
         I32 po;
        for (po = AvMAX(PL_comppad); po > PL_padix_floor; po--) {
-           if (PL_curpad[po] && !SvIMMORTAL(PL_curpad[po]))
+           if (PL_curpad[po] && !SvIMMORTAL(PL_curpad[po])
+            && (  PadnamelistMAX(PL_comppad_name) < po
+               || !PadnamelistARRAY(PL_comppad_name)[po]
+               || !PadnameLEN(PadnamelistARRAY(PL_comppad_name)[po]) ))
                SvPADTMP_off(PL_curpad[po]);
        }
        PL_padix = PL_padix_floor;