[ARM] Avoid dereferencing null pointers

Alan Modra amodra@gmail.com
Wed Nov 20 22:25:00 GMT 2019


On Thu, Nov 21, 2019 at 08:31:57AM +1030, Alan Modra wrote:
> On Thu, Nov 21, 2019 at 08:19:03AM +1030, Alan Modra wrote:
> > Using this should work:
> > 
> > 	  if (!is_arm_elf (input_bfd)
> > 	      || elf_sym_hashes (input_bfd) == 0
> > 	      || (elf_dyn_lib_class (input_bfd) & DYN_AS_NEEDED) != 0)
> > 	    continue;
> 
> Actually, that might not be such a good idea.  An object without any
> global symbols will have sym_hashes NULL too.

So, getting back to this after a small interruption,

	  if (!is_arm_elf (input_bfd))
	    continue;
	  if ((input_bfd->flags & DYNAMIC) != 0
	      && (elf_sym_hashes (input_bfd) == NULL
		  || (elf_dyn_lib_class (input_bfd) & DYN_AS_NEEDED) != 0))
	    continue;

-- 
Alan Modra
Australia Development Lab, IBM



More information about the Binutils mailing list