This is the mail archive of the
elfutils-devel@sourceware.org
mailing list for the elfutils project.
[PATCH] backends: aarch64_check_special_symbol check shdr is not NULL before usage.
- From: Mark Wielaard <mjw at redhat dot com>
- To: elfutils-devel at lists dot fedorahosted dot org
- Date: Tue, 14 Jan 2014 22:14:23 +0100
- Subject: [PATCH] backends: aarch64_check_special_symbol check shdr is not NULL before usage.
Signed-off-by: Mark Wielaard <mjw@redhat.com>
---
backends/ChangeLog | 5 +++++
backends/aarch64_symbol.c | 9 ++++++---
2 files changed, 11 insertions(+), 3 deletions(-)
diff --git a/backends/ChangeLog b/backends/ChangeLog
index 4ea1acd..a742eb2 100644
--- a/backends/ChangeLog
+++ b/backends/ChangeLog
@@ -1,3 +1,8 @@
+2014-01-14 Mark Wielaard <mjw@redhat.com>
+
+ * aarch64_symbol.c (aarch64_check_special_symbol): Check shdr is
+ not NULL before usage.
+
2014-01-04 Mark Wielaard <mjw@redhat.com>
* ppc64_symbol.c (ppc64_machine_flag_check): New function.
diff --git a/backends/aarch64_symbol.c b/backends/aarch64_symbol.c
index e41a7a7..3fdc9cf 100644
--- a/backends/aarch64_symbol.c
+++ b/backends/aarch64_symbol.c
@@ -73,9 +73,12 @@ aarch64_check_special_symbol (Elf *elf, GElf_Ehdr *ehdr, const GElf_Sym *sym,
{
GElf_Shdr shdr_mem;
GElf_Shdr *shdr = gelf_getshdr (scn, &shdr_mem);
- sname = elf_strptr (elf, ehdr->e_shstrndx, shdr->sh_name);
- if (sname != NULL && strcmp (sname, ".got") == 0)
- return sym->st_value == shdr->sh_addr;
+ if (shdr != NULL)
+ {
+ sname = elf_strptr (elf, ehdr->e_shstrndx, shdr->sh_name);
+ if (sname != NULL && strcmp (sname, ".got") == 0)
+ return sym->st_value == shdr->sh_addr;
+ }
}
}
}
--
1.8.4.2