On 5/19/22 09:48, Viktor Prutyanov wrote:
+if (ehdr->e_ident[EI_CLASS] != ELFCLASS64 ||
+ehdr->e_ident[EI_DATA] != ELFDATA2LSB) {
+eprintf("Invalid ELF class or byte order, must be 64-bit LE\n");
+return false;
+}
You could check EI_VERSION == EV_CURRENT too.
Add ELF header checking to prevent processing input file which is not
QEMU guest memory dump or even not ELF.
Resolves: https://gitlab.com/qemu-project/qemu/-/issues/1013
Signed-off-by: Viktor Prutyanov
---
contrib/elf2dmp/qemu_elf.c | 38 ++
1 file changed,