[PATCH] readelf: Correct overflow check for length in print_debug_aranges_section.

Mark Wielaard mjw at redhat.com
Tue Dec 16 15:31:30 UTC 2014


Signed-off-by: Mark Wielaard <mjw at redhat.com>
---
 src/ChangeLog | 1 +
 src/readelf.c | 2 +-
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/ChangeLog b/src/ChangeLog
index 1dc1957..7960496 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -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-16  Mark Wielaard  <mjw at redhat.com>
 
diff --git a/src/readelf.c b/src/readelf.c
index 3c686d5..9c62853 100644
--- a/src/readelf.c
+++ b/src/readelf.c
@@ -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)
-- 
1.8.3.1



More information about the elfutils-devel mailing list