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]

[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


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