Fix mistake in recent code to check for an unterminated leb128 number.
authorNick Clifton <nickc@redhat.com>
Fri, 13 Feb 2015 11:13:20 +0000 (11:13 +0000)
committerNick Clifton <nickc@redhat.com>
Fri, 13 Feb 2015 11:13:20 +0000 (11:13 +0000)
* dwarf.c (read_leb128): Fix test for shift becoming too large.

binutils/coffgrok.c
binutils/dwarf.c

index 5dc9558078562b39b5d6e4da2d71c00cd7ebc79b..2bbfdc45b42bc4af07ccdc87a24eb6a6a21b952a 100644 (file)
@@ -668,8 +668,13 @@ do_define (unsigned int i, struct coff_scope *b)
 
          if (!is->init)
            {
+             long high = s->where->offset + s->type->size; 
+
              is->low = s->where->offset;
-             is->high = s->where->offset + s->type->size;
+             is->high = high;
+             /* PR 17512: file: 37e7a80d.  */
+             if (is->high != high)
+               fatal (_("Out of range type size: %u"), s->type->size);
              is->init = 1;
              is->parent = s->where->section;
            }
index dad381f34943b0ddb388dd35fb22094cb0f58963..936f63438e4165c97b201a4f082f879b3498a2cb 100644 (file)
@@ -284,7 +284,7 @@ read_leb128 (unsigned char *data,
 
       /* PR 17512: file: 0ca183b8.
         FIXME: Should we signal this error somehow ?  */
-      if (shift >= sizeof (result))
+      if (shift >= sizeof (result) * 8)
        break;
     }