aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMark Wielaard <mark@klomp.org>2018-02-26 22:53:10 +0100
committerMark Wielaard <mark@klomp.org>2018-03-05 13:56:06 +0100
commit22e282071021fc5ada2b9294bfa7e25fbd62a9d6 (patch)
treec238abd6b467ae8232d9c51bcd50f9b1f6212e29 /src
parentebc1768e4451e30b19c8e1644515e66de8da4b4d (diff)
downloadelfutils-22e282071021fc5ada2b9294bfa7e25fbd62a9d6.tar.gz
elflint: Make sure we can read a whole element when iterating over group.
Change the for loop so that we can always read a full element. https://sourceware.org/bugzilla/show_bug.cgi?id=22892 Signed-off-by: Mark Wielaard <mark@klomp.org>
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog5
-rw-r--r--src/elflint.c2
2 files changed, 6 insertions, 1 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 0ae01e92..e73c6154 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,5 +1,10 @@
2018-02-09 Mark Wielaard <mark@klomp.org>
+ * elflint.c (check_group): Make sure we can read a complete
+ element when iterating over the group.
+
+2018-02-09 Mark Wielaard <mark@klomp.org>
+
* readelf.c (attr_callback): Handle DW_FORM_data16 as Dwarf_Block.
2018-02-09 Mark Wielaard <mark@klomp.org>
diff --git a/src/elflint.c b/src/elflint.c
index df1b3a03..ebb0e4e0 100644
--- a/src/elflint.c
+++ b/src/elflint.c
@@ -2713,7 +2713,7 @@ section [%2d] '%s': section group with only one member\n"),
ERROR (gettext ("section [%2d] '%s': unknown section group flags\n"),
idx, section_name (ebl, idx));
- for (cnt = elsize; cnt < data->d_size; cnt += elsize)
+ for (cnt = elsize; cnt + elsize <= data->d_size; cnt += elsize)
{
#if ALLOW_UNALIGNED
val = *((Elf32_Word *) ((char *) data->d_buf + cnt));