aboutsummaryrefslogtreecommitdiff
path: root/bfd
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2022-09-12 18:58:53 +0930
committerAlan Modra <amodra@gmail.com>2022-09-14 10:19:56 +0930
commit72e366db620f5b2264290d9ba3b62df74bd0c40b (patch)
tree3261c7fa98793c8c384711dc3a6968e8451c955b /bfd
parent3cb5e955a372f0303992340a164a21ca5cf6d006 (diff)
downloadgdb-72e366db620f5b2264290d9ba3b62df74bd0c40b.zip
gdb-72e366db620f5b2264290d9ba3b62df74bd0c40b.tar.gz
gdb-72e366db620f5b2264290d9ba3b62df74bd0c40b.tar.bz2
ubsan: som_is_space null dereference
On objcopy of fuzzed file. * som.c (som_write_fixups): Exit loop if space sections all processed.
Diffstat (limited to 'bfd')
-rw-r--r--bfd/som.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/bfd/som.c b/bfd/som.c
index c22f13b..38c574a 100644
--- a/bfd/som.c
+++ b/bfd/som.c
@@ -2933,8 +2933,10 @@ som_write_fixups (bfd *abfd,
asection *subsection;
/* Find a space. */
- while (!som_is_space (section))
+ while (section && !som_is_space (section))
section = section->next;
+ if (!section)
+ break;
/* Now iterate through each of its subspaces. */
for (subsection = abfd->sections;