This is the mail archive of the binutils-cvs@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]

[binutils-gdb] Fix static analysis warning about undefined bheaviour.


https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=7460c0abe8a195243110e66624da095a44cc96d6

commit 7460c0abe8a195243110e66624da095a44cc96d6
Author: Nick Clifton <nickc@redhat.com>
Date:   Tue Dec 8 09:49:49 2015 +0000

    Fix static analysis warning about undefined bheaviour.
    
    	PR binutils/19310
    	* dwarf.c (display_debug_frames): Recode range test to avoid
    	undefined behaviour.

Diff:
---
 binutils/ChangeLog | 6 ++++++
 binutils/dwarf.c   | 2 +-
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/binutils/ChangeLog b/binutils/ChangeLog
index feeb405..02e3683 100644
--- a/binutils/ChangeLog
+++ b/binutils/ChangeLog
@@ -1,3 +1,9 @@
+2015-12-08  Nick Clifton  <nickc@redhat.com>
+
+	PR binutils/19310
+	* dwarf.c (display_debug_frames): Recode range test to avoid
+	undefined behaviour.
+
 2015-12-03  Tristan Gingold  <gingold@adacore.com>
 
 	* od-macho.c (bfd_mach_o_header_flags_name): Add name
diff --git a/binutils/dwarf.c b/binutils/dwarf.c
index 03e0117..0f6818f 100644
--- a/binutils/dwarf.c
+++ b/binutils/dwarf.c
@@ -6459,7 +6459,7 @@ display_debug_frames (struct dwarf_section *section,
 
 	    case DW_CFA_def_cfa_expression:
 	      ul = LEB ();
-	      if (start >= block_end || start + ul > block_end || start + ul < start)
+	      if (start >= block_end || ul > (unsigned long) (block_end - start))
 		{
 		  printf (_("  DW_CFA_def_cfa_expression: <corrupt len %lu>\n"), ul);
 		  break;


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]