PR29807, SIGSEGV when linking fuzzed PE object
authorAlan Modra <amodra@gmail.com>
Fri, 18 Nov 2022 22:03:20 +0000 (08:33 +1030)
committerAlan Modra <amodra@gmail.com>
Mon, 21 Nov 2022 21:48:49 +0000 (08:18 +1030)
PR 29807
* cofflink.c (_bfd_coff_generic_relocate_section): Skip relocs
against symbols with a NULL section.

bfd/cofflink.c

index a5b936fd7c136ed0063e4d64cf5edaff1af64152..cd117a445c6188b87be1eb825643fac7adb94712 100644 (file)
@@ -2961,8 +2961,10 @@ _bfd_coff_generic_relocate_section (bfd *output_bfd,
              sec = sections[symndx];
 
              /* PR 19623: Relocations against symbols in
-                the absolute sections should ignored.  */
-             if (bfd_is_abs_section (sec))
+                the absolute sections should ignored.
+                PR 29807: Also ignore relocs against file symbols or
+                other such nonsense in fuzzed objects.  */
+             if (sec == NULL || bfd_is_abs_section (sec))
                continue;
 
              val = (sec->output_section->vma