Fix static analysis warning about undefined bheaviour.
authorNick Clifton <nickc@redhat.com>
Tue, 8 Dec 2015 09:49:49 +0000 (09:49 +0000)
committerNick Clifton <nickc@redhat.com>
Tue, 8 Dec 2015 09:49:49 +0000 (09:49 +0000)
PR binutils/19310
* dwarf.c (display_debug_frames): Recode range test to avoid
undefined behaviour.

binutils/ChangeLog
binutils/dwarf.c

index feeb4055b45627526ad42397321b88932846786f..02e36839f5ea1adcabdbe1441a74c42b75258dc9 100644 (file)
@@ -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
index 03e01175ccc7cfec7fb9c631070ff9dac66de432..0f6818fe8b39e8df01008b12f3b4bbdc2eed6ca0 100644 (file)
@@ -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;
This page took 0.17951 seconds and 4 git commands to generate.