[Bug general/24068] readelf.c:10152:15: error: ‘%*llx’ directive output between 4 and 2147483647 bytes may cause result to exceed ‘INT_MAX’ [-Werror=format-overflow=] with -m32
mark at klomp dot org
sourceware-bugzilla@sourceware.org
Sun Jan 13 17:02:00 GMT 2019
https://sourceware.org/bugzilla/show_bug.cgi?id=24068
Mark Wielaard <mark at klomp dot org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Last reconfirmed| |2019-01-13
CC| |mark at klomp dot org
Ever confirmed|0 |1
--- Comment #1 from Mark Wielaard <mark at klomp dot org> ---
This is weird. I cannot replicate with a standard build and gcc (GCC) 9.0.0
20190112 (experimental).
Aha, with -m32. hmmm. Odd.
So the issue seems to be that GCC doesn't realize digits is capped between 4
and 16. We could help with with something like:
diff --git a/src/readelf.c b/src/readelf.c
index 3a73710ff..83b700eee 100644
--- a/src/readelf.c
+++ b/src/readelf.c
@@ -10128,7 +10128,7 @@ print_debug_str_section (Dwfl_Module *dwflmod
__attribute__ ((unused)),
++digits;
tmp >>= 4;
}
- digits = MAX (4, digits);
+ digits = MIN (16, MAX (4, digits));
printf (gettext ("\nDWARF section [%2zu] '%s' at offset %#" PRIx64 ":\n"
" %*s String\n"),
I that the correct fix though? Or is something else going on?
I don't understand why this is -m32 specific.
--
You are receiving this mail because:
You are on the CC list for the bug.
More information about the Elfutils-devel
mailing list