From 66ad6b4458091b6bb7fbc327308ceabaaba02e8b Mon Sep 17 00:00:00 2001 From: Alan Modra Date: Wed, 26 Aug 2020 17:58:40 +0930 Subject: PR26453 UBSAN: som.c:2885 null pointer memcpy PR 26453 * som.c (som_prep_for_fixups): Return early when no symbols. --- bfd/ChangeLog | 5 +++++ bfd/som.c | 3 +++ 2 files changed, 8 insertions(+) diff --git a/bfd/ChangeLog b/bfd/ChangeLog index 2fd2321..20a02d9 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,5 +1,10 @@ 2020-08-26 Alan Modra + PR 26453 + * som.c (som_prep_for_fixups): Return early when no symbols. + +2020-08-26 Alan Modra + PR 26418 * ecofflink.c (WRITE): Don't write size 0 chunks. diff --git a/bfd/som.c b/bfd/som.c index 4f0a606..93a0ad8 100644 --- a/bfd/som.c +++ b/bfd/som.c @@ -2804,6 +2804,9 @@ som_prep_for_fixups (bfd *abfd, asymbol **syms, unsigned long num_syms) asymbol **sorted_syms; size_t amt; + if (num_syms == 0) + return TRUE; + /* Most SOM relocations involving a symbol have a length which is dependent on the index of the symbol. So symbols which are used often in relocations should have a small index. */ -- cgit v1.1