public inbox for elfutils@sourceware.org
 help / color / mirror / Atom feed
* [COMMITTED] readelf: Cast Dwarf_Word length to ptrdiff_t for comparison.
@ 2014-11-26 23:34 Mark Wielaard
  0 siblings, 0 replies; only message in thread
From: Mark Wielaard @ 2014-11-26 23:34 UTC (permalink / raw)
  To: elfutils-devel

[-- Attachment #1: Type: text/plain, Size: 1205 bytes --]

My last patch caused a compiler warning/error on some setups. My apologies.

Avoid comparison between signed and unsigned integer expressions warning.

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

diff --git a/src/ChangeLog b/src/ChangeLog
index 0082e65..a6d18b5 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -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
diff --git a/src/readelf.c b/src/readelf.c
index 00986d1..cd15e4c 100644
--- a/src/readelf.c
+++ b/src/readelf.c
@@ -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)
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2014-11-26 23:34 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-11-26 23:34 [COMMITTED] readelf: Cast Dwarf_Word length to ptrdiff_t for comparison Mark Wielaard

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).