ubsan: som_is_space null dereference
authorAlan Modra <amodra@gmail.com>
Mon, 12 Sep 2022 09:28:53 +0000 (18:58 +0930)
committerAlan Modra <amodra@gmail.com>
Wed, 14 Sep 2022 00:49:56 +0000 (10:19 +0930)
On objcopy of fuzzed file.

* som.c (som_write_fixups): Exit loop if space sections all
processed.

bfd/som.c

index c22f13b5a4c7342446c971f121c5916df29afc5e..38c574a97c850a4e750e521194dd50c45380a161 100644 (file)
--- 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;