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 sign-compare in dwarf.c


Hi!

Some gcc versions fail for the recent security enhancements, see eg.
http://toolchain.lug-owl.de/buildbot/show_build_details.php?id=377119:

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/sh4-linux/_install_/share/locale\"" -Dbin_dummy_emulation=bin_vanilla_emulation  -W -Wall -Wstrict-prototypes -Wmissing-prototypes -Wshadow -Werror -g -O2 -MT dwarf.o -MD -MP -MF .deps/dwarf.Tpo -c -o dwarf.o /home/vaxbuild/repos/binutils_gdb/binutils/dwarf.c
/home/vaxbuild/repos/binutils_gdb/binutils/dwarf.c: In function âprocess_extended_line_opâ:
/home/vaxbuild/repos/binutils_gdb/binutils/dwarf.c:419:38: error: comparison between signed and unsigned integer expressions [-Werror=sign-compare]
   if (len == 0 || data == end || len > (end - data))
                                      ^
cc1: all warnings being treated as errors
Makefile:932: recipe for target 'dwarf.o' failed
make[3]: *** [dwarf.o] Error 1


Just cast it away?

MfG, JBG


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

binutils/
	* dwarf.c (process_extended_line_op): Fix signedness warning.


diff --git a/binutils/dwarf.c b/binutils/dwarf.c
index e1e2b35..a3a1ebd 100644
--- a/binutils/dwarf.c
+++ b/binutils/dwarf.c
@@ -416,7 +416,7 @@ process_extended_line_op (unsigned char * data,
   len = read_uleb128 (data, & bytes_read, end);
   data += bytes_read;
 
-  if (len == 0 || data == end || len > (end - data))
+  if (len == 0 || data == end || len > (unsigned int) (end - data))
     {
       warn (_("Badly formed extended line op encountered!\n"));
       return bytes_read;

-- 
      Jan-Benedict Glaw      jbglaw@lug-owl.de              +49-172-7608481
Signature of:         "really soon now":      an unspecified period of time, likly to
the second  :                                 be greater than any reasonable definition
                                              of "soon".

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]