Re: [pcre-dev] PCRE2 10.35-RC1 testing release is available

Page principale
Supprimer ce message
Auteur: Petr Pisar
Date:  
À: pcre-dev
Sujet: Re: [pcre-dev] PCRE2 10.35-RC1 testing release is available
On Thu, Apr 23, 2020 at 04:43:07PM +0100, ph10@??? wrote:
> On Thu, 16 Apr 2020, Petr Pisar via Pcre-dev wrote:
>
> > I noticed a new warning with GCC 10:
> >
> > gcc -DHAVE_CONFIG_H -I. -I./src  "-I./src"     -pthread -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -mshstk  -c -o src/pcre2test-pcre2test.o `test -f 'src/pcre2test.c' || echo './'`src/pcre2test.c
> > src/pcre2test.c: In function 'copy_and_get':
> > src/pcre2test.c:3062:27: warning: array subscript -1 is outside array bounds of 'uint32_t[256]' {aka 'unsigned int[256]'} [-Warray-bounds]
> >  3062 | if (length < 0) length = p[-1];

>
> I have committed some revised code. Does this solve the issue?
>

It does not. The compiler is too smart (or dumb). The warning has changed
into:

src/pcre2test.c:3078:12: warning: array subscript -1 is outside array bounds of ‘uint32_t[256]’ {aka ‘unsigned int[256]’} [-Warray-bounds]
 3078 |   length = *pp;
      |            ^~~
src/pcre2test.c:6391:12: note: while referencing ‘copybuffer’
 6391 |   uint32_t copybuffer[256];
      |            ^~~~~~~~~~


-- Petr