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

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

Thread Previous
From:
Tony Cook via RT
Date:
April 23, 2014 01:43
Subject:
[perl #121712] [PATCH] Coverity: regcomp.c etc.
Message ID:
rt-4.0.18-23065-1398217387-1768.121712-15-0@perl.org
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

---
via perlbug:  queue: perl5 status: new
https://rt.perl.org/Ticket/Display.html?id=121712

Thread Previous


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