This is the mail archive of the binutils@sourceware.org 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]

[BUILDROBOT, PATCH] Fix format string warning (was: gdb and binutils branch master updated. e0a31db1b16fe0a010aa46185e4a31a08e7fd97f


On Tue, 2014-11-04 15:29:59 -0000, nickc@sourceware.org <nickc@sourceware.org> wrote:
> commit e0a31db1b16fe0a010aa46185e4a31a08e7fd97f
> Author: Nick Clifton <nickc@redhat.com>
> Date:   Tue Nov 4 15:29:03 2014 +0000
> 
>     More fixes for memory corruption when readelf processes corrupt files.
>     
>     	PR binutils/17531
[...]
>     	(print_dynamic_symbol): Catch out of range symbol indicies.
>     	(process_mips_specific): Likewise.

The process_mips_specific() part will trigger a warning with
"gcc (Debian 4.9.1-8) 4.9.1", see eg.
http://toolchain.lug-owl.de/buildbot/show_build_details.php?id=372787 :

/bin/bash ./libtool --tag=CC   --mode=link gcc -W -Wall -Wstrict-prototypes -Wmissing-prototypes -Wshadow -Werror -g -O2  -static-libstdc++ -static-libgcc  -o addr2line addr2line.o bucomm.o version.o filemode.o ../bfd/libbfd.la ../libiberty/libiberty.a  -lz -ldl 
libtool: link: gcc -W -Wall -Wstrict-prototypes -Wmissing-prototypes -Wshadow -Werror -g -O2 -static-libstdc++ -static-libgcc -o addr2line addr2line.o bucomm.o version.o filemode.o  ../bfd/.libs/libbfd.a ../libiberty/libiberty.a -lz -ldl
gcc -DHAVE_CONFIG_H -I. -I/home/vaxbuild/repos/binutils_gdb/binutils  -I. -I/home/vaxbuild/repos/binutils_gdb/binutils -I../bfd -I/home/vaxbuild/repos/binutils_gdb/binutils/../bfd -I/home/vaxbuild/repos/binutils_gdb/binutils/../include -DLOCALEDIR="\"/home/vaxbuild/build/arm-eabi/_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/vaxbuild/repos/binutils_gdb/binutils/readelf.c
/home/vaxbuild/repos/binutils_gdb/binutils/readelf.c: In function âprocess_mips_specificâ:
/home/vaxbuild/repos/binutils_gdb/binutils/readelf.c:13522:3: error: format â%luâ expects argument of type âlong unsigned intâ, but argument 2 has type âsize_tâ [-Werror=format=]
   printf (_("<symbol index %lu exceeds number of dynamic symbols>"), i);
   ^
cc1: all warnings being treated as errors
Makefile:932: recipe for target 'readelf.o' failed
make[3]: *** [readelf.o] Error 1
make[3]: Leaving directory '/home/vaxbuild/build/arm-eabi/build-binutils-full/binutils'
Makefile:974: recipe for target 'all-recursive' failed



Shall we simply cast it away?

2014-11-05  Jan-Benedict Glaw  <jbglaw@lug-owl.de>

	* readelf.c (process_mips_specific): Fix format string warning.
 
diff --git a/binutils/readelf.c b/binutils/readelf.c
index 7c0c3ff..18465e6 100644
--- a/binutils/readelf.c
+++ b/binutils/readelf.c
@@ -13519,7 +13519,8 @@ process_mips_specific (FILE * file)
 		    printf (_("<corrupt: %14ld>"), psym->st_name);
 		}
 	      else
-		printf (_("<symbol index %lu exceeds number of dynamic symbols>"), i);
+		printf (_("<symbol index %lu exceeds number of dynamic symbols>"),
+			(unsigned long) i);
 
 	      printf ("\n");
 	    }

MfG, JBG

-- 
      Jan-Benedict Glaw      jbglaw@lug-owl.de              +49-172-7608481
  Signature of:                        Lauf nicht vor Deinem GlÃck davon:
  the second  :                             Es kÃnnte hinter Dir stehen!

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]