develooper Front page | perl.perl5.porters | Postings from April 2014

Re: [perl #121712] [PATCH] Coverity: regcomp.c etc.

Thread Previous | Thread Next
From:
Jarkko Hietaniemi
Date:
April 23, 2014 01:48
Subject:
Re: [perl #121712] [PATCH] Coverity: regcomp.c etc.
Message ID:
CAJuepptViKbOokaAVgOPu_-zqCGJ2ukDasPHbkWu5xZyLuX40A@mail.gmail.com
I guess one could assert that the number of names is less than or equal to
the number of bits in U32, yes.
On Apr 22, 2014 9:43 PM, "Tony Cook via RT" <perlbug-followup@perl.org>
wrote:

> On Tue Apr 22 17:33:07 2014, jhi wrote:
> > Needed compile-time limits for the PL_reg_intflags_name so that the
> > bit loop doesn't waltz off past the array.  Could not use C_ARRAY_LENGTH
> > because the size of name array is not visible during compile time
> > (only const char*[] is), so modified regcomp.pl to generate the size,
> > made it visible only for the re extension.  Did extflags analogously
> > even though its size currently exactly 32 already.  The sizeof(flags)*8
> > is extra paranoia for ILP64.
>
> Wouldn't the paranoia in:
>
> +    for (bit=0;
> +         bit<REG_EXTFLAGS_NAME_SIZE && bit<sizeof(flags)*8;
> +         bit++) {
>
> be better handled with an assert?  Even a compile-time assert if we had
> the mechanism for it.
>
> Tony
>

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