diff options
author | Mark Wielaard <mark@klomp.org> | 2020-05-09 21:05:31 +0200 |
---|---|---|
committer | Mark Wielaard <mark@klomp.org> | 2020-05-14 14:30:57 +0200 |
commit | 5d769dd05d2e10dd35dc34e105d6f1f19b57d124 (patch) | |
tree | ec51e51ffea9b85afa526d4ec6c12d8e3a7e5164 /src/objdump.c | |
parent | 24d6569408c2039a97054f3e6999cb174c076242 (diff) | |
download | elfutils-5d769dd05d2e10dd35dc34e105d6f1f19b57d124.tar.gz |
src: Check ebl_openbackend result before using ebl handle.
GCC10 -fanalyzer plus -flto sees that ebl_openbackend can fail and
return NULL. Most of the time we will get a dummy ebl, but in case
of out of memory or corrupt ELF header it might return NULL. Make
sure that we report a (fatal) error in that case in all tools.
Signed-off-by: Mark Wielaard <mark@klomp.org>
Diffstat (limited to 'src/objdump.c')
-rw-r--r-- | src/objdump.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/objdump.c b/src/objdump.c index a619674f..82d7bcf6 100644 --- a/src/objdump.c +++ b/src/objdump.c @@ -755,6 +755,9 @@ handle_elf (Elf *elf, const char *prefix, const char *fname, /* Get the backend for this object file type. */ Ebl *ebl = ebl_openbackend (elf); + if (ebl == NULL) + error (EXIT_FAILURE, 0, + gettext ("cannot create backend for elf file")); printf ("%s: elf%d-%s\n\n", fname, gelf_getclass (elf) == ELFCLASS32 ? 32 : 64, |