This is the mail archive of the
binutils-cvs@sourceware.org
mailing list for the binutils project.
[binutils-gdb] Fix mistake in recent code to check for an unterminated leb128 number.
- From: Nick Clifton <nickc at sourceware dot org>
- To: bfd-cvs at sourceware dot org
- Date: 13 Feb 2015 11:14:07 -0000
- Subject: [binutils-gdb] Fix mistake in recent code to check for an unterminated leb128 number.
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=f641dd969f91a83adf319b269c2411141b0a26a9
commit f641dd969f91a83adf319b269c2411141b0a26a9
Author: Nick Clifton <nickc@redhat.com>
Date: Fri Feb 13 11:13:20 2015 +0000
Fix mistake in recent code to check for an unterminated leb128 number.
* dwarf.c (read_leb128): Fix test for shift becoming too large.
Diff:
---
binutils/coffgrok.c | 7 ++++++-
binutils/dwarf.c | 2 +-
2 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/binutils/coffgrok.c b/binutils/coffgrok.c
index 5dc9558..2bbfdc4 100644
--- a/binutils/coffgrok.c
+++ b/binutils/coffgrok.c
@@ -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;
}
diff --git a/binutils/dwarf.c b/binutils/dwarf.c
index dad381f..936f634 100644
--- a/binutils/dwarf.c
+++ b/binutils/dwarf.c
@@ -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;
}