ubsan: som_is_space null dereference

Alan Modra amodra@gmail.com
Wed Sep 14 00:41:14 GMT 2022


On objcopy of fuzzed file.

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

diff --git a/bfd/som.c b/bfd/som.c
index c22f13b5a4c..38c574a97c8 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;

-- 
Alan Modra
Australia Development Lab, IBM


More information about the Binutils mailing list