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>
+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.
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));