This is the mail archive of the
mailing list for the elfutils project.
Re: [PATCH] libelf: Always set ELF maxsize when reading an ELF file for sanity checks.
- From: Mark Wielaard <mjw at redhat dot com>
- To: elfutils-devel at lists dot fedorahosted dot org
- Date: Thu, 10 Nov 2016 12:17:13 +0100
- Subject: Re: [PATCH] libelf: Always set ELF maxsize when reading an ELF file for sanity checks.
On Wed, 2016-10-26 at 13:17 +0200, Mark Wielaard wrote:
> There are various sanity checks that depend on knowing the file size
> of the underlying ELF file which we only used when mmapping the ELF file.
> Although we probably won't crash if we use pread to try to read from
> the file, we still might return completely bogus data structures. This
> could cause us to malloc insane amounts of memory.
> Always try to get the maxsize when unknown in elf_begin.c (read_file).
Again I didn't hear back from the original reporter whether this
really solved their problem. But the change does look correct and
desirable. So I have pushed this to master now.