[binutils-gdb] ubsan: alpha: member access within null pointer

Alan Modra amodra@sourceware.org
Fri Sep 3 07:03:03 GMT 2021


https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=f2cfdb748606b3e634050b8f7030e5e7783a4232

commit f2cfdb748606b3e634050b8f7030e5e7783a4232
Author: Alan Modra <amodra@gmail.com>
Date:   Fri Sep 3 08:18:15 2021 +0930

    ubsan: alpha: member access within null pointer
    
            * elf64-alpha.c (elf64_alpha_relax_with_lituse): Avoid UB.

Diff:
---
 bfd/elf64-alpha.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/bfd/elf64-alpha.c b/bfd/elf64-alpha.c
index 6f5eeadf256..6427406fb19 100644
--- a/bfd/elf64-alpha.c
+++ b/bfd/elf64-alpha.c
@@ -3191,7 +3191,8 @@ elf64_alpha_relax_with_lituse (struct alpha_relax_info *info,
     }
 
   /* Can't relax dynamic symbols.  */
-  if (alpha_elf_dynamic_symbol_p (&info->h->root, info->link_info))
+  if (info->h != NULL
+      && alpha_elf_dynamic_symbol_p (&info->h->root, info->link_info))
     return true;
 
   changed_contents = info->changed_contents;


More information about the Binutils-cvs mailing list