2017-10-04 Mark Wielaard <mark@klomp.org>
+ * elf_begin.c (file_read_elf): Skip sanity checking e_shoff if scncnt
+ is zero, we won't use it then.
+
+2017-10-04 Mark Wielaard <mark@klomp.org>
+
* libelfP.h: Add ELF_E_INVALID_ELF to error values enum.
* elf_error.c (ELF_E_INVALID_ELF_IDX): New define. Use it as value
for ELF_E_INVALID_ELF in msgidx.
|| (((uintptr_t) ((char *) ehdr + e_shoff)
& (__alignof__ (Elf32_Shdr) - 1)) == 0)))
{
- if (unlikely (e_shoff >= maxsize)
+ if (unlikely (scncnt > 0 && e_shoff >= maxsize)
|| unlikely (maxsize - e_shoff
< scncnt * sizeof (Elf32_Shdr)))
{
|| (((uintptr_t) ((char *) ehdr + e_shoff)
& (__alignof__ (Elf64_Shdr) - 1)) == 0)))
{
- if (unlikely (e_shoff >= maxsize)
+ if (unlikely (scncnt > 0 && e_shoff >= maxsize)
|| unlikely (maxsize - e_shoff
< scncnt * sizeof (Elf64_Shdr)))
goto free_and_out;