readelf: Cast Dwarf_Word length to ptrdiff_t for comparison.
authorMark Wielaard <mjw@redhat.com>
Wed, 26 Nov 2014 23:12:32 +0000 (00:12 +0100)
committerMark Wielaard <mjw@redhat.com>
Wed, 26 Nov 2014 23:15:14 +0000 (00:15 +0100)
Avoids comparison between signed and unsigned integer expressions warning.

Signed-off-by: Mark Wielaard <mjw@redhat.com>
src/ChangeLog
src/readelf.c

index 0082e65..a6d18b5 100644 (file)
@@ -1,3 +1,8 @@
+2014-11-26  Mark Wielaard  <mjw@redhat.com>
+
+       * readelf.c (print_debug_aranges_section): Cast Dwarf_Word length
+       to ptrdiff_t for comparison.
+
 2014-11-24  Mark Wielaard  <mjw@redhat.com>
 
        * readelf.c (print_debug_line_section): Check line_range is not zero
index 00986d1..cd15e4c 100644 (file)
@@ -4693,7 +4693,7 @@ print_debug_aranges_section (Dwfl_Module *dwflmod __attribute__ ((unused)),
       printf (gettext ("\n Length:        %6" PRIu64 "\n"),
              (uint64_t) length);
 
-      if (unlikely (length > readendp - readp))
+      if (unlikely ((ptrdiff_t) length > readendp - readp))
        goto invalid_data;
 
       if (length == 0)