kstenerud / Musashi

Motorola 680x0 emulator written in C
412 stars 93 forks source link

sprintf #108

Open mix127 opened 2 months ago

mix127 commented 2 months ago

In function ‘sprintf’, inlined from ‘get_imm_str_s’ at external/Musashi//m68kdasm.c:410:3, inlined from ‘d68020_cmpi_pcix_8’ at external/Musashi//m68kdasm.c:1416:8, inlined from ‘d68020_cmpi_pcdi_8’ at external/Musashi//m68kdasm.c:1412:13: /usr/include/x86_64-linux-gnu/bits/stdio2.h:30:10: note: ‘builtin___sprintf_chk’ output between 2 and 21 bytes into a destination of size 15 30 | return builtin_sprintf_chk (s, USE_FORTIFY_LEVEL - 1, | ^~~~~~~~~~~~~~ 31 | glibc_objsize (s), fmt, | ~~~~~~~~~ 32 | va_arg_pack ()); | ~~~~~ external/Musashi//m68kdasm.c: In function ‘d68000_cmpi_8’: external/Musashi//m68kdasm.c:410:32: warning: ‘%s’ directive writing up to 19 bytes into a region of size 14 [-Wformat-overflow=] 369 | return str; | ~~~
...... 410 | sprintf(str, "#%s", make_signed_hex_str_8(read_imm_8())); | ^~ In function ‘sprintf’, inlined from ‘get_imm_str_s’ at external/Musashi//m68kdasm.c:410:3, inlined from ‘d68000_cmpi_8’ at external/Musashi//m68kdasm.c:1400:14: /usr/include/x86_64-linux-gnu/bits/stdio2.h:30:10: note: ‘
builtin_sprintf_chk’ output between 2 and 21 bytes into a destination of size 15 30 | return builtin_sprintf_chk (s, USE_FORTIFY_LEVEL - 1, | ^~~~~~~~~~~~~~ 31 | glibc_objsize (s), fmt, | ~~~~~~~~~ 32 | va_arg_pack ()); | ~~~~~ external/Musashi//m68kdasm.c: In function ‘d68000_addi_32’: external/Musashi//m68kdasm.c:414:32: warning: ‘%s’ directive writing up to 19 bytes into a region of size 14 [-Wformat-overflow=] 401 | return str; | ~~~
...... 414 | sprintf(str, "#%s", make_signed_hex_str_32(read_imm_32())); | ^~ In function ‘sprintf’, inlined from ‘get_imm_str_s’ at external/Musashi//m68kdasm.c:414:3, inlined from ‘d68000_addi_32’ at external/Musashi//m68kdasm.c:785:14: /usr/include/x86_64-linux-gnu/bits/stdio2.h:30:10: note: ‘
builtin_sprintf_chk’ output between 2 and 21 bytes into a destination of size 15 30 | return builtin_sprintf_chk (s, USE_FORTIFY_LEVEL - 1, | ^~~~~~~~~~~~~~ 31 | glibc_objsize (s), fmt, | ~~~~~~~~~ 32 | __va_arg_pack ()); | ~~~~~ external/Musashi//m68kdasm.c: In function ‘d68000_addi_16’: external/Musashi//m68kdasm.c:412:32: warning: ‘%s’ directive writing up to 19 bytes into a region of size 14 [-Wformat-overflow=]

kstenerud commented 2 months ago

I'm not able to replicate on my system (macos, clang-1500.3.9.4), but I've added a commit to increase buffer sizes according to the warnings you've seen. Can you check if the latest commit fixes it?