The ELF64 case didn't check for overflow and accidentially used the 32bit
Shdr size.
Signed-off-by: Mark Wielaard <mjw@redhat.com>
+2014-12-11 Mark Wielaard <mjw@redhat.com>
+
+ * elf_begin.c (file_read_elf): Correct ELF64 section offset check.
+
2014-12-11 Mark Wielaard <mjw@redhat.com>
* elf_begin.c (read_long_names): Check for offset overflow.
elf->state.elf64.ehdr = ehdr;
if (unlikely (ehdr->e_shoff >= maxsize)
- || unlikely (ehdr->e_shoff
- + scncnt * sizeof (Elf32_Shdr) > maxsize))
+ || unlikely (maxsize - ehdr->e_shoff
+ < scncnt * sizeof (Elf64_Shdr)))
goto free_and_out;
elf->state.elf64.shdr
= (Elf64_Shdr *) ((char *) ehdr + ehdr->e_shoff);