This is the mail archive of the binutils@sourceware.org mailing list for the binutils 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]

Re: [ARM] Avoid dereferencing null pointers


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


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