develooper Front page | perl.perl5.porters | Postings from May 2011

Re: [perl #91032] Invalid free in t/op/write.t

Thread Previous | Thread Next
From:
Nicholas Clark
Date:
May 21, 2011 13:59
Subject:
Re: [perl #91032] Invalid free in t/op/write.t
Message ID:
20110521205921.GB23881@plum.flirble.org
On Sat, May 21, 2011 at 07:32:15PM +0100, Nicholas Clark wrote:

>     p4raw-id: //depot/perl@19496

> +    assert (fpc <= fops + maxops); /* ensure our buffer estimate was valid */
>      arg = fpc - fops;
>      { /* need to jump to the next word */
>          int z;

The assertion triggers on the test case until this change:

commit f5c235e79ea25787354a22de0af257a672e955a0
Author: Dave Mitchell <davem@fdisolutions.com>
Date:   Tue Dec 30 15:07:50 2003 +0000

    Re: [perl #24774] eval + format - \n = pp_ctl.c assertion
    heuristics for calculating buffer size needed to compile a format
    didn't allow for \0

    p4raw-id: //depot/perl@22005

diff --git a/pp_ctl.c b/pp_ctl.c
index ec79e24..48e3618 100644
--- a/pp_ctl.c
+++ b/pp_ctl.c
@@ -3580,7 +3580,7 @@ S_doparseform(pTHX_ SV *sv)

     /* estimate the buffer size needed */
     for (base = s; s <= send; s++) {
-       if (*s == '\n' || *s == '@' || *s == '^')
+       if (*s == '\n' || *s == '\0' || *s == '@' || *s == '^')
            maxops += 10;
     }
     s = base;


[tests snipped]

> I'm certainly not going to get a chance to look at this for at least 36 hours
> (and maybe not even then)

That statement already technically disproven because I did get enough to run
another bisect. But I think that that's it. I'm not in a position to figure
this out or fix it.

But something is telling me that the heuristics are, well, heuristics, and
at times wrong. Which in this case is a bad sort of wrong.

Nicholas Clark

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About