]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
PR 33210 NULL pointer arithmetic in coffcode.h
authorAlan Modra <amodra@gmail.com>
Thu, 24 Jul 2025 23:18:20 +0000 (08:48 +0930)
committerAlan Modra <amodra@gmail.com>
Fri, 25 Jul 2025 02:17:04 +0000 (11:47 +0930)
Fix ubsan "runtime error: applying zero offset to null pointer".

bfd/coffcode.h

index b81195dd2ec5b95e9b9740510525436db40ab095..a2ee03622565c1ec19f2a7a62c4906b06cc72fc5 100644 (file)
@@ -909,7 +909,9 @@ fill_comdat_hash (bfd *abfd)
   if (! _bfd_coff_get_external_symbols (abfd))
     return true;
 
-  esymstart = esym = (bfd_byte *) obj_coff_external_syms (abfd);
+  esymstart = esym = obj_coff_external_syms (abfd);
+  if (esym == NULL)
+    return true;
   esymend = esym + obj_raw_syment_count (abfd) * bfd_coff_symesz (abfd);
 
   for (struct internal_syment isym;