aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2025-07-25 08:48:20 +0930
committerAlan Modra <amodra@gmail.com>2025-07-25 11:47:04 +0930
commit626987854890e7a0b7479e5b33f1c24459b219cd (patch)
tree841ca3d361d054dcfe41a15fa9b03640b8c05a4d
parentd92b908cb14e801063a9cc8a18a4dfc0acd7ebb5 (diff)
downloadbinutils-626987854890e7a0b7479e5b33f1c24459b219cd.zip
binutils-626987854890e7a0b7479e5b33f1c24459b219cd.tar.gz
binutils-626987854890e7a0b7479e5b33f1c24459b219cd.tar.bz2
PR 33210 NULL pointer arithmetic in coffcode.h
Fix ubsan "runtime error: applying zero offset to null pointer".
-rw-r--r--bfd/coffcode.h4
1 files changed, 3 insertions, 1 deletions
diff --git a/bfd/coffcode.h b/bfd/coffcode.h
index b81195d..a2ee036 100644
--- a/bfd/coffcode.h
+++ b/bfd/coffcode.h
@@ -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;