summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Wielaard <mark@klomp.org>2019-04-28 13:40:45 +0200
committerMark Wielaard <mark@klomp.org>2019-04-28 13:40:45 +0200
commit7190c2043152477b720e204166d0690da9c7b913 (patch)
treed8d627a379fe1c92ae253a169c45feb56615df7b
parent6f42d2dc90d2e0cfb3974f67e2ffe3d7b1723157 (diff)
downloadelfutils-7190c2043152477b720e204166d0690da9c7b913.tar.gz
libebl: Check ebl is not NULL in ebl_symbol_[binding|type]_name.
For STB_GNU_UNIQUE and STT_GNU_IFUNC we need to check the elf of the given ebl. Make sure the ebl given isn't NULL. Signed-off-by: Mark Wielaard <mark@klomp.org>
-rw-r--r--libebl/ChangeLog7
-rw-r--r--libebl/eblsymbolbindingname.c1
-rw-r--r--libebl/eblsymboltypename.c1
3 files changed, 9 insertions, 0 deletions
diff --git a/libebl/ChangeLog b/libebl/ChangeLog
index acc68919..e050bfc1 100644
--- a/libebl/ChangeLog
+++ b/libebl/ChangeLog
@@ -1,3 +1,10 @@
+2019-04-28 Mark Wielaard <mark@klomp.org>
+
+ * eblsymbolbindingname.c (ebl_symbol_binding_name): Check ebl is
+ not NULL for STB_GNU_UNIQUE.
+ * eblsymboltypename.c (ebl_symbol_type_name): Check ebl is not
+ NULL for STT_GNU_IFUNC.
+
2019-01-29 Mark Wielaard <mark@klomp.org>
* eblobjnote.c (ebl_object_note): Check pr_datasz padding doesn't
diff --git a/libebl/eblsymbolbindingname.c b/libebl/eblsymbolbindingname.c
index 97974253..75565fe8 100644
--- a/libebl/eblsymbolbindingname.c
+++ b/libebl/eblsymbolbindingname.c
@@ -58,6 +58,7 @@ ebl_symbol_binding_name (Ebl *ebl, int binding, char *buf, size_t len)
if (binding >= STB_LOPROC && binding <= STB_HIPROC)
snprintf (buf, len, "LOPROC+%d", binding - STB_LOPROC);
else if (binding == STB_GNU_UNIQUE
+ && ebl != NULL
&& (ident = elf_getident (ebl->elf, NULL)) != NULL
&& ident[EI_OSABI] == ELFOSABI_LINUX)
return "GNU_UNIQUE";
diff --git a/libebl/eblsymboltypename.c b/libebl/eblsymboltypename.c
index 09fa8748..53b145a8 100644
--- a/libebl/eblsymboltypename.c
+++ b/libebl/eblsymboltypename.c
@@ -64,6 +64,7 @@ ebl_symbol_type_name (Ebl *ebl, int symbol, char *buf, size_t len)
if (symbol >= STT_LOPROC && symbol <= STT_HIPROC)
snprintf (buf, len, "LOPROC+%d", symbol - STT_LOPROC);
else if (symbol == STT_GNU_IFUNC
+ && ebl != NULL
&& (ident = elf_getident (ebl->elf, NULL)) != NULL
&& ident[EI_OSABI] == ELFOSABI_LINUX)
return "GNU_IFUNC";