Master and -Wformat-overflow warning

Jeffrey Walton <[email protected]>
Newsgroups gmane.comp.debugging.valgrind
Message-ID <CAH8yC8mKcDQwTn686xj-YCfRAUgCV-Owe4huq6dBoeKjNORoaQ@mail.gmail.com>
Hi Everyone,

I'm building Master on an ARM Cortex A7 dev-board with GCC 7.4.0.

It looks like GCC has one squawk:

gcc -DHAVE_CONFIG_H -I. -I..  -I.. -I../include -I../include -I../VEX/pub -I../V
EX/pub -DVGA_arm=1 -DVGO_linux=1 -DVGP_arm_linux=1 -DVGPV_arm_linux_vanilla=1  -
I../coregrind -DVG_LIBDIR="\"/usr/local/lib/valgrind"\" -DVG_PLATFORM="\"arm-lin
ux\"" -g2 -O3  -O2 -g -Wall -Wmissing-prototypes -Wshadow -Wpointer-arith -Wstri
ct-prototypes -Wmissing-declarations -Wcast-qual -Wwrite-strings -Wempty-body -W
format -Wformat-signedness -Wformat-security -Wignored-qualifiers -Wmissing-para
meter-type -Wlogical-op -Wimplicit-fallthrough=2 -Wold-style-declaration -finlin
e-functions -fno-stack-protector -fno-strict-aliasing -fno-builtin  -marm -mcpu=
cortex-a8 -DENABLE_LINUX_TICKET_LOCK -g2 -O3 -MT m_aspacemgr/libcoregrind_arm_li
nux_a-aspacemgr-segnames.o -MD -MP -MF m_aspacemgr/.deps/libcoregrind_arm_linux_
a-aspacemgr-segnames.Tpo -c -o m_aspacemgr/libcoregrind_arm_linux_a-aspacemgr-se
gnames.o `test -f 'm_aspacemgr/aspacemgr-segnames.c' || echo './'`m_aspacemgr/as
pacemgr-segnames.c
vgdb.c: In function ‘standalone_send_commands’:
vgdb.c:1008:21: warning: ‘%02x’ directive writing between 2 and 8 bytes into a r
egion of size 3 [-Wformat-overflow=]
       sprintf(hex, "%02x", cksum);
                     ^~~~
vgdb.c:1008:20: note: directive argument in the range [0, 2147483647]
       sprintf(hex, "%02x", cksum);
                    ^~~~~~
In file included from /usr/include/stdio.h:862:0,
                 from vgdb.c:42:
/usr/include/arm-linux-gnueabihf/bits/stdio2.h:33:10: note: ‘__builtin___sprintf
_chk’ output between 3 and 9 bytes into a destination of size 3
   return __builtin___sprintf_chk (__s, __USE_FORTIFY_LEVEL - 1,
          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
       __bos (__s), __fmt, __va_arg_pack ());
       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
mv -f m_aspacemgr/.deps/libcoregrind_arm_linux_a-aspacemgr-segnames.Tpo m_aspace
mgr/.deps/libcoregrind_arm_linux_a-aspacemgr-segnames.Po

Jeff


_______________________________________________
Valgrind-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/valgrind-users
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.