PR25172, Wrong description of --stop-address=ADDR switch
[deliverable/binutils-gdb.git] / binutils / dwarf.c
index 19ae1edca7649ec8572cc86cd7818f63b5d81872..2fe469f060368b896720d98738f2680291c52355 100644 (file)
@@ -1848,16 +1848,9 @@ check_uvalue (const unsigned char * start,
 {
   dwarf_vma max_uvalue = end - start;
 
-  /* FIXME: Testing "(start + uvalue) < start" miscompiles with gcc 4.8.3
-     running on an x86_64 host in 32-bit mode.  So we pre-compute the value
-     here.  */
-  const unsigned char * ptr = start + uvalue;
-
   /* See PR 17512: file: 008-103549-0.001:0.1.
      and PR 24829 for examples of where these tests are triggered.  */
-  if (uvalue > max_uvalue
-      || ptr > end
-      || ptr < start)
+  if (uvalue > max_uvalue)
     {
       warn (_("Corrupt attribute block length: %lx\n"), (long) uvalue);
       uvalue = max_uvalue;
@@ -2006,9 +1999,6 @@ get_type_signedness (unsigned char *        start,
 
   * is_signed = FALSE;
 
-  if (data >= end)
-    return;
-
   abbrev_number = read_uleb128 (data, & bytes_read, end);
   data += bytes_read;
 
@@ -2049,6 +2039,8 @@ get_type_signedness (unsigned char *        start,
                 NB/ We need to avoid infinite recursion.  */
              return;
            }
+         if (uvalue >= (size_t) (end - start))
+           return;
          get_type_signedness (start, start + uvalue, end, pointer_size,
                               offset_size, dwarf_version, is_signed, TRUE);
          break;
@@ -2732,7 +2724,8 @@ read_and_display_attr_value (unsigned long           attribute,
   switch (attribute)
     {
     case DW_AT_type:
-      if (level >= 0 && level < MAX_CU_NESTING)
+      if (level >= 0 && level < MAX_CU_NESTING
+         && uvalue < (size_t) (end - start))
        {
          bfd_boolean is_signed = FALSE;
 
This page took 0.024321 seconds and 4 git commands to generate.