This is the mail archive of the elfutils-devel@sourceware.org mailing list for the elfutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[COMMITTED] 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>
---
 libebl/ChangeLog              | 7 +++++++
 libebl/eblsymbolbindingname.c | 1 +
 libebl/eblsymboltypename.c    | 1 +
 3 files changed, 9 insertions(+)

diff --git a/libebl/ChangeLog b/libebl/ChangeLog
index acc68919a..e050bfc15 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 97974253a..75565fe81 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 09fa87480..53b145a83 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";
-- 
2.20.1


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]