libdwfl: Make sure dwfl_elf_phdr_memory_callback returns at least minread
authorMark Wielaard <mark@klomp.org>
Thu, 23 Dec 2021 22:16:25 +0000 (23:16 +0100)
committerMark Wielaard <mark@klomp.org>
Mon, 3 Jan 2022 23:36:49 +0000 (00:36 +0100)
commit1cf73965853037301a6099dea5368a1303cde2ba
tree7de7e275009a2fa2eb04b54712a6a807a4a76609
parent4fdd85881c8acd06db737c45ea6aabc60aef3d4d
libdwfl: Make sure dwfl_elf_phdr_memory_callback returns at least minread

The callers of dwfl_elf_phdr_memory_callback assume at least minread
bytes are read and available. Make sure to check start is smaller than
elf->maximum_size before reading more. Return false if end - start is
smaller than minread.

Found by afl-fuzz.

Signed-off-by: Mark Wielaard <mark@klomp.org>
libdwfl/ChangeLog
libdwfl/core-file.c