https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88835

--- Comment #10 from Martin Sebor <msebor at gcc dot gnu.org> ---
I've built the top of binutils-gdb with the patch referenced in comment #8
applied and with -Wformat-overflow=2 and -Wformat-truncation=2 and got the
following breakdown:

Diagnostic                        Count   Unique    Files
-Wformat-overflow=                   19       19       10
-Wformat-truncation=                 12       12        7
-Wconflicts-sr                        7        7        7
-Wmaybe-uninitialized                 3        3        3
-Wstringop-truncation                 2        2        2
-Wconflicts-rr                        2        2        2
-Wsign-compare                        1        1        1
-Wother                               1        1        1


The -Wformat-overflow warnings are:

/src/binutils-gdb/gas/macro.c:386:18: warning: ‘sprintf’ may write a
terminating nul past the end of the destination [-Wformat-overflow=]
/src/binutils-gdb/binutils/arsup.c:158:20: warning: ‘%.*s’ directive output
between 0 and 2147483647 bytes may exceed minimum required size of 4095
[-Wformat-overflow=]
/src/binutils-gdb/binutils/wrstabs.c:426:21: warning: ‘sprintf’ may write a
terminating nul past the end of the destination [-Wformat-overflow=]
/src/binutils-gdb/binutils/wrstabs.c:739:27: warning: ‘%u’ directive writing
between 1 and 10 bytes into a region of size between 7 and 45
[-Wformat-overflow=]
/src/binutils-gdb/binutils/wrstabs.c:620:26: warning: ‘%ld’ directive writing
between 1 and 20 bytes into a region of size between 19 and 38
[-Wformat-overflow=]
/src/binutils-gdb/binutils/wrstabs.c:595:26: warning: ‘%ld’ directive writing
between 1 and 20 bytes into a region of size between 19 and 38
[-Wformat-overflow=]
eelf_iamcu.c:635:25: warning: ‘%.*s’ directive output between 0 and 2147483647
bytes may exceed minimum required size of 4095 [-Wformat-overflow=]
eelf_iamcu.c:628:25: warning: ‘%.*s’ directive output between 0 and 2147483647
bytes may exceed minimum required size of 4095 [-Wformat-overflow=]
eelf_x86_64.c:638:25: warning: ‘%.*s’ directive output between 0 and 2147483647
bytes may exceed minimum required size of 4095 [-Wformat-overflow=]
eelf_x86_64.c:631:25: warning: ‘%.*s’ directive output between 0 and 2147483647
bytes may exceed minimum required size of 4095 [-Wformat-overflow=]
eelf_i386.c:638:25: warning: ‘%.*s’ directive output between 0 and 2147483647
bytes may exceed minimum required size of 4095 [-Wformat-overflow=]
eelf_i386.c:631:25: warning: ‘%.*s’ directive output between 0 and 2147483647
bytes may exceed minimum required size of 4095 [-Wformat-overflow=]
eelf32_x86_64.c:638:25: warning: ‘%.*s’ directive output between 0 and
2147483647 bytes may exceed minimum required size of 4095 [-Wformat-overflow=]
eelf32_x86_64.c:631:25: warning: ‘%.*s’ directive output between 0 and
2147483647 bytes may exceed minimum required size of 4095 [-Wformat-overflow=]
eelf_k1om.c:638:25: warning: ‘%.*s’ directive output between 0 and 2147483647
bytes may exceed minimum required size of 4095 [-Wformat-overflow=]
eelf_k1om.c:631:25: warning: ‘%.*s’ directive output between 0 and 2147483647
bytes may exceed minimum required size of 4095 [-Wformat-overflow=]
eelf_l1om.c:638:25: warning: ‘%.*s’ directive output between 0 and 2147483647
bytes may exceed minimum required size of 4095 [-Wformat-overflow=]
eelf_l1om.c:631:25: warning: ‘%.*s’ directive output between 0 and 2147483647
bytes may exceed minimum required size of 4095 [-Wformat-overflow=]
/src/binutils-gdb/gdb/gdbserver/remote-utils.c:1188:21: warning: ‘%s’ directive
output between 0 and 8191 bytes may exceed minimum required size of 4095
[-Wformat-overflow=]

None for readelf.c.  I think they are all for sprintf (and not printf or
fprintf), so I'm not sure where the ones you are seeing are coming from.

Reply via email to