|
When getting section headers it is assumed that the first section
is on the first section list. However, it is possible that the
first section list only contains the zeroth section, in which
case either illegal memory access occurs or elf_nextscn()
erroneously returns NULL.
With this patch, checks are added to avoid the illegal memory
access and (if available) the second section list is looked at
to find the first section.
A new test emptyfile is added that tests adding a section to
and "empty" ELF file 32/64 class with ELF_C_RDWR[_MMAP].
Signed-off-by: John Ogness <john.ogness@linutronix.de>
Signed-off-by: Mark Wielaard <mjw@redhat.com>
|