This is the mail archive of the
elfutils-devel@sourceware.org
mailing list for the elfutils project.
[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
- From: "marxin.liska at gmail dot com" <sourceware-bugzilla at sourceware dot org>
- To: elfutils-devel at sourceware dot org
- Date: Mon, 14 Jan 2019 10:26:01 +0000
- Subject: [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
- Auto-submitted: auto-generated
- References: <bug-24068-10460@http.sourceware.org/bugzilla/>
https://sourceware.org/bugzilla/show_bug.cgi?id=24068
Martin Liška <marxin.liska at gmail dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
See Also| |https://gcc.gnu.org/bugzill
| |a/show_bug.cgi?id=88835
--- Comment #2 from Martin Liška <marxin.liska at gmail dot com> ---
(In reply to Mark Wielaard from comment #1)
> 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:
Probably.
>
> 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 can confirm it fixes that.
> I don't understand why this is -m32 specific.
Me neither, so that I created GCC PR for that.
--
You are receiving this mail because:
You are on the CC list for the bug.