diff options
author | Alan Modra <amodra@gmail.com> | 2023-08-03 07:29:58 +0930 |
---|---|---|
committer | Alan Modra <amodra@gmail.com> | 2023-08-03 21:19:04 +0930 |
commit | 760fb390fd4ce506abd401e8a75fc0a510b82d48 (patch) | |
tree | 57f837f9737f009df0d000d3e3b8f23afd09cb12 /opcodes | |
parent | 1720b64f735ff2798ab50ea9e2a40ab42af6cc6e (diff) | |
download | gdb-760fb390fd4ce506abd401e8a75fc0a510b82d48.zip gdb-760fb390fd4ce506abd401e8a75fc0a510b82d48.tar.gz gdb-760fb390fd4ce506abd401e8a75fc0a510b82d48.tar.bz2 |
objdump, nm: sprintf sanitizer null destination pointer
Seen on Ubuntu 23.04 x86_64-linux using gcc-12.2 and gcc-12.3 with
CFLAGS="-m32 -g -O2 -fsanitize=address,undefined".
CC objdump.o
In file included from /usr/include/stdio.h:906,
from /home/alan/src/binutils-gdb/binutils/sysdep.h:24,
from /home/alan/src/binutils-gdb/binutils/objdump.c:51:
In function 'sprintf',
inlined from 'display_utf8' at /home/alan/src/binutils-gdb/binutils/objdump.c:621:14,
inlined from 'sanitize_string.part.0' at /home/alan/src/binutils-gdb/binutils/objdump.c:742:11:
/usr/include/bits/stdio2.h:30:10: error: null destination pointer [-Werror=format-overflow=]
30 | return __builtin___sprintf_chk (__s, __USE_FORTIFY_LEVEL - 1,
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
31 | __glibc_objsize (__s), __fmt,
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
32 | __va_arg_pack ());
| ~~~~~~~~~~~~~~~~~
cc1: all warnings being treated as errors
The warning is bogus of course. xmalloc is guaranteed to return
non-NULL, but apparently this isn't seen in display_utf6. The same
doesn't happen with -m64, maybe due to inlining differences, I haven't
investigated fully. Easily avoided as we hardly need to use sprintf
for a single char, or a two char string.
* objdump.c (display_utf8): Avoid bogus sprintf sanitizer warning.
Use hex ESC to switch back to default colour.
(sanitize_string): Comment. Bump buffer size by one. Fix overlong
line.
* nm.c (display_utf8, sanitize_string): As above.
Diffstat (limited to 'opcodes')
0 files changed, 0 insertions, 0 deletions