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:44:26AM +0100, Christophe Lyon wrote:
> I'm not sure I understand your comment about an object without any
> global symbols: whatever the reason, if sym_hashes is NULL, cmse_scan
> will crash, won't it?

No, because cmse_scan only uses sym_hashes for global syms.  If there
are no globals it should be fine with sym_hashes NULL.

> Also, I see cmse_scan has an early exit when local_syms is NULL,

That's an error exit on not being able to read local syms.

> wouldn't it be cleaner to check if sym_hashes is NULL is cmse_scan
> too?

Nope, because it looks to me like cmse_scan needs to work on a
relocatable object file with only local syms.  (At least, it should
report errors about any __acle_se_* local syms.)

As I said in another email, you could add a check that cmse_hash is
non-NULL before dereferencing.

-- 
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]