Re: Master and -Wformat-overflow warning
Jeffrey Walton <[email protected]>
| Newsgroups | gmane.comp.debugging.valgrind |
|---|---|
| Message-ID | <CAH8yC8mDZ4O0KZvgo=TKyTL=Yb8m4N3sYbkM8uY3CgZY7MMZuA@mail.gmail.com> |
On Thu, May 2, 2019 at 12:06 PM Jeffrey Walton <[email protected]> wrote: > > ... > > > vgdb.c:1008:20: note: directive argument in the range [0, 2147483647] > > > sprintf(hex, "%02x", cksum); > > > ^~~~~~ > > > > But cksum is an unsigned char, so value is be between [0, 255]. Which > > is max 2 hex chars. > > > > Could you retry with GCC8 or GCC9? > > And file a bug against GCC otherwise? > > I thought it might be something like that. > > I believe the char get promoted to an int for printf since it is > variadic. Maybe it would just be easier to workaround the finding by > making the buffer larger to accommodate an int. > > Its not Valgrind's problem to be sure. Valgrind is just > working/playing nice with other tools. Yeah, there were some warnings about potential false positives: * https://gcc.gnu.org/onlinedocs/gcc-8.1.0/gcc/Warning-Options.html * https://developers.redhat.com/blog/2017/02/22/memory-error-detection-using-gcc/ It looks like the issue has already been raised at https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79257. Jeff