readelf: Correct overflow check for length in print_debug_aranges_section.
authorMark Wielaard <mjw@redhat.com>
Tue, 16 Dec 2014 15:30:59 +0000 (16:30 +0100)
committerMark Wielaard <mjw@redhat.com>
Wed, 17 Dec 2014 15:49:02 +0000 (16:49 +0100)
Signed-off-by: Mark Wielaard <mjw@redhat.com>
src/ChangeLog
src/readelf.c

index 112af19..576ed83 100644 (file)
@@ -2,6 +2,7 @@
 
        * readelf.c (print_debug_line_section): Correct overflow check for
        unit_length.
+       (print_debug_aranges_section): Correct overflow check for length.
 
 2014-12-15  Mark Wielaard  <mjw@redhat.com>
 
index 3c686d5..9c62853 100644 (file)
@@ -4711,7 +4711,7 @@ print_debug_aranges_section (Dwfl_Module *dwflmod __attribute__ ((unused)),
       printf (gettext ("\n Length:        %6" PRIu64 "\n"),
              (uint64_t) length);
 
-      if (unlikely ((ptrdiff_t) length > readendp - readp))
+      if (unlikely (length > (size_t) (readendp - readp)))
        goto invalid_data;
 
       if (length == 0)