Created attachment 9946 [details]
# eu-elflint -d $FILE
==5053==AddressSanitizer CHECK failed: /tmp/portage/sys-devel/gcc-6.3.0/work/gcc-6.3.0/libsanitizer/sanitizer_common/sanitizer_common.cc:180 "((0 && "unable to mmap")) != (0)" (0x0, 0x0)
#7 0x431b8d in xcalloc /tmp/portage/dev-libs/elfutils-0.168/work/elfutils-0.168/lib/xmalloc.c:64
Compiled with: gcc-6.3.0
The allocation failure is caused by the insane large ph_num. We can limit the amount of memory we need by first checking we can at least read the headers and only allocate/check that number (and do the same for shnum).
Author: Mark Wielaard <firstname.lastname@example.org>
Date: Tue Mar 28 01:25:34 2017 +0200
elflint: Sanity check the number of phdrs and shdrs available.
Make sure we can at least read the shnum sections or phnum segments.
Limit the number we do check to those we can actually read.
Signed-off-by: Mark Wielaard <email@example.com>