aboutsummaryrefslogtreecommitdiff
path: root/bfd/som.c
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2020-08-26 17:58:40 +0930
committerAlan Modra <amodra@gmail.com>2020-08-26 23:23:44 +0930
commit66ad6b4458091b6bb7fbc327308ceabaaba02e8b (patch)
treea4dc0f8fa2a1b7b0aa1894c5bca04aefde6fa3c6 /bfd/som.c
parentd8d6da137d7ececcd0e10c575aa187bb8c9b24e0 (diff)
downloadbinutils-66ad6b4458091b6bb7fbc327308ceabaaba02e8b.zip
binutils-66ad6b4458091b6bb7fbc327308ceabaaba02e8b.tar.gz
binutils-66ad6b4458091b6bb7fbc327308ceabaaba02e8b.tar.bz2
PR26453 UBSAN: som.c:2885 null pointer memcpy
PR 26453 * som.c (som_prep_for_fixups): Return early when no symbols.
Diffstat (limited to 'bfd/som.c')
-rw-r--r--bfd/som.c3
1 files changed, 3 insertions, 0 deletions
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. */