In theory the gelf_update_ehdr call could fail. Immediately report an
error in that case.
Signed-off-by: Mark Wielaard <mark@klomp.org>
+2019-03-06 Mark Wielaard <mark@klomp.org>
+
+ * asm_end.c (binary_end): Check return value of gelf_update_ehdr.
+
2018-10-19 Mark Wielaard <mark@klomp.org>
* disasm_cb.c (read_symtab_exec): Check sh_entsize is not zero.
else
ehdr->e_shstrndx = elf_ndxscn (shstrscn);
- gelf_update_ehdr (ctx->out.elf, ehdr);
+ if (unlikely (gelf_update_ehdr (ctx->out.elf, ehdr) == 0))
+ {
+ __libasm_seterrno (ASM_E_LIBELF);
+ result = -1;
+ }
/* Write out the ELF file. */
if (unlikely (elf_update (ctx->out.elf, ELF_C_WRITE_MMAP) < 0))