This is the mail archive of the mailing list for the binutils project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH, BUILDROBOT] readelf.c:process_dynamic_section(): signed-vs-unsigned warning in format string (was: gdb and binutils branch master updated. 071436c6e94be13904438b6eb70ee79c73354a61)

On Fri, 2014-11-07 13:40:42 -0000, <> wrote:
> commit 071436c6e94be13904438b6eb70ee79c73354a61
> Author: Nick Clifton <>
> Date:   Fri Nov 7 13:39:45 2014 +0000
>     Add more fixes for inavlid memory accesses triggered by corrupt files.
>     	PR binutils/17531
>     	* readelf.c (get_data): Avoid allocating memory when we know that
>     	the read will fail.
>     	(find_section_by_type): New function.
>     	(get_unwind_section_word): Check for invalid symbol indicies.
>     	Check for invalid reloc types.
>     	(get_32bit_dynamic_section): Add range checks.
>     	(get_64bit_dynamic_section): Add range checks.
>     	(process_dynamic_section): Check for a corrupt time value.

My build robot found this on gcc111:
/bin/sh ./libtool --tag=CC   --mode=link gcc -W -Wall -Wstrict-prototypes -Wmissing-prototypes -Wshadow -Werror -g -O2  -static-libstdc++ -static-libgcc -Wl,-bbigtoc -o addr2line addr2line.o bucomm.o version.o filemode.o ../bfd/ ../libiberty/libiberty.a -lintl -lz
libtool: link: gcc -W -Wall -Wstrict-prototypes -Wmissing-prototypes -Wshadow -Werror -g -O2 -static-libstdc++ -static-libgcc -Wl,-bbigtoc -o addr2line addr2line.o bucomm.o version.o filemode.o  ../bfd/.libs/libbfd.a ../libiberty/libiberty.a -L/opt/freeware/lib -lintl -L/users3/olivap/sb/p64/export/power_510_32/usr/lib -L/gestconf/project/GNOME_ACL/GNOME/build/sh_dev_GNOME/export/power_510_32/usr/lib -L/gestconf/project/GNOME_ACL/GNOME/build/latest/export/power_510_32/usr/lib -L/users/project/PDP/PDP_51_050/usr/ccs/lib -L/users/project/PDP/PDP_51_050/usr/lib -liconv -lz -Wl,-blibpath:/opt/freeware/lib:/opt/freeware/lib/gcc/powerpc-ibm-aix7.1.0.0/4.8.1:/opt/freeware/lib/gcc/powerpc-ibm-aix7.1.0.0/4.8.1/../../..:/usr/lib:/lib
gcc -DHAVE_CONFIG_H -I. -I/home/jbglaw/repos/binutils_gdb/binutils  -I. -I/home/jbglaw/repos/binutils_gdb/binutils -I../bfd -I/home/jbglaw/repos/binutils_gdb/binutils/../bfd -I/home/jbglaw/repos/binutils_gdb/binutils/../include -DLOCALEDIR="\"/home/jbglaw/build/xstormy16-elf/_install_/share/locale\"" -Dbin_dummy_emulation=bin_vanilla_emulation  -W -Wall -Wstrict-prototypes -Wmissing-prototypes -Wshadow -Werror -g -O2 -MT readelf.o -MD -MP -MF .deps/readelf.Tpo -c -o readelf.o /home/jbglaw/repos/binutils_gdb/binutils/readelf.c
/home/jbglaw/repos/binutils_gdb/binutils/readelf.c: In function 'process_dynamic_section':
/home/jbglaw/repos/binutils_gdb/binutils/readelf.c:8883:3: error: format '%lx' expects argument of type 'long unsigned int', but argument 2 has type 'time_t' [-Werror=format=]
   printf (_("<corrupt time val: %lx"), atime);
cc1: all warnings being treated as errors
make[3]: *** [readelf.o] Error 1

I propose this:

2014-11-07  Jan-Benedict Glaw  <>
	* readelf.c (process_dynamic_section): Fix warning.

diff --git a/binutils/ChangeLog b/binutils/ChangeLog
index b0c6bb2..5d54de6 100644
--- a/binutils/ChangeLog
+++ b/binutils/ChangeLog
@@ -1,3 +1,7 @@
+2014-11-07  Jan-Benedict Glaw  <>
+	* readelf.c (process_dynamic_section): Fix warning.
 2014-11-07  Nick Clifton  <>
 	PR binutils/17531
diff --git a/binutils/readelf.c b/binutils/readelf.c
index 5bd3a4b..83318c1 100644
--- a/binutils/readelf.c
+++ b/binutils/readelf.c
@@ -8880,7 +8880,7 @@ process_dynamic_section (FILE * file)
 	      tmp = gmtime (&atime);
 	      /* PR 17533 file: 041-1244816-0.004.  */
 	      if (tmp == NULL)
-		printf (_("<corrupt time val: %lx"), atime);
+		printf (_("<corrupt time val: %lx"), (unsigned long) atime);
 		printf ("%04u-%02u-%02uT%02u:%02u:%02u\n",
 			tmp->tm_year + 1900, tmp->tm_mon + 1, tmp->tm_mday,

      Jan-Benedict Glaw              +49-172-7608481
Signature of:             God put me on earth to accomplish a certain number of
the second  :            things. Right now I am so far behind I will never die.

Attachment: signature.asc
Description: Digital signature

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]