develooper Front page | perl.perl5.porters | Postings from October 2008

Re: [PATCH] Invalid read in regdupe in maint-5.8

Thread Previous | Thread Next
From:
Nicholas Clark
Date:
October 6, 2008 09:33
Subject:
Re: [PATCH] Invalid read in regdupe in maint-5.8
Message ID:
20081006163332.GI49043@plum.flirble.org
On Thu, Sep 25, 2008 at 05:53:14PM +0200, Vincent Pit wrote:
> On maint-5.8, valgrind reports an invalid read of total size 4 (the size
> of a regnode) in regcomp.c:Perl_regdupe:4845 when creating threads
> (testcase attached). Compared to what is allocated in pregcomp, it seems
> that the computed len is one regnode too long. The patch attached fixes
> the error and passes all tests with 34415.
> 
> Vincent.


> --- regcomp.c	2008-09-19 23:03:55.000000000 +0200
> +++ regcomp.c	2008-09-25 17:30:56.000000000 +0200
> @@ -4840,7 +4840,7 @@
>      len = r->offsets[0];
>      npar = r->nparens+1;
>  
> -    size = sizeof(regexp) + (len+1)*sizeof(regnode);
> +    size = sizeof(regexp) + len*sizeof(regnode);
>      Newxc(ret, size, char, regexp);
>      Copy(r, ret, size, char);
>  

Thanks applied (change 34467)

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