Open dodona2 opened 6 years ago
Any idea why gcc7 thinks that b is between 0 and 2147483647? It's unsigned char.
the format string expects a long, and b is promoted to int. iirc :)
'the format string expects a long, and b is promoted to int. iirc :)' can someone please fix ithis?
Let's hope the gcc developers will fix this. IMO this is the same bug: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81483
Still seems to be present with gcc 8. However you can resolve by changing the format string to "%.2hhX" in the sprintf on line 659.
just for the case it is not known:
vbindiff.cpp: In member function ‘void FileDisplay::setByte(short int, short int, Byte)’: vbindiff.cpp:635:6: warning: ‘%02X’ directive writing between 2 and 8 bytes into a region of size 3 [-Wformat-overflow=] void FileDisplay::setByte(short x, short y, Byte b) ^
~~vbindiff.cpp:635:6: note: directive argument in the range [0, 2147483647] vbindiff.cpp:659:12: note: ‘sprintf’ output between 3 and 9 bytes into a destination of size 3 sprintf(str, "%02X", b);