mirror of
https://github.com/ibm-s390-linux/s390-tools.git
synced 2026-08-05 02:14:52 +00:00
zdump/dfi_elf: Don't accept ELF input with zero-sized PT_LOAD segments
The DFI memory chunk manager cannot handle PT_LOAD segments of size 0. This can lead to a NULL pointer access in mem_chunk_find() in case zgetdump is given an invalid VMCORE ELF file as input which contains only zero-sized ELF PT_LOAD segments. Instead of crashing, show an error message and terminate gracefully. The TELA test dump_with_zero_sized_segments.sh can reproduce this bug. Signed-off-by: Alexander Egorenkov <egorenar@linux.ibm.com> Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
This commit is contained in:
committed by
Jan Höppner
parent
3b6920271e
commit
38b520ab4c
@@ -42,6 +42,8 @@ static int pt_load_add(Elf64_Phdr *phdr)
|
||||
STDERR("Dump file \"%s\" is a user space core dump\n",
|
||||
g.opts.device);
|
||||
}
|
||||
if (phdr->p_memsz == 0)
|
||||
return -EINVAL;
|
||||
if (phdr->p_offset + phdr->p_filesz > zg_size(g.fh))
|
||||
return -EINVAL;
|
||||
if (phdr->p_filesz == 0) {
|
||||
|
||||
Reference in New Issue
Block a user