Signed-off-by: Mark Wielaard <[email protected]>
---
 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  <[email protected]>
+
+       * aarch64_symbol.c (aarch64_check_special_symbol): Check shdr is
+       not NULL before usage.
+
 2014-01-04  Mark Wielaard  <[email protected]>
 
        * 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

Reply via email to