[03/10] ld: Fix segfault in populate_publics_stream

Message ID 20221209015240.6348-3-mark@harmstone.com
State Accepted
Headers
Series [01/10] ld: Generate PDB string table |

Checks

Context Check Description
snail/binutils-gdb-check success Github commit url

Commit Message

Mark Harmstone Dec. 9, 2022, 1:52 a.m. UTC
  ---
 ld/pdb.c | 3 +++
 1 file changed, 3 insertions(+)
  

Patch

diff --git a/ld/pdb.c b/ld/pdb.c
index b37a5a0ebfd..3edeab25332 100644
--- a/ld/pdb.c
+++ b/ld/pdb.c
@@ -1410,6 +1410,9 @@  populate_publics_stream (bfd *stream, bfd *abfd, bfd *sym_rec_stream)
   for (bfd *in = coff_data (abfd)->link_info->input_bfds; in;
        in = in->link.next)
     {
+      if (!in->outsymbols)
+	continue;
+
       for (unsigned int i = 0; i < in->symcount; i++)
 	{
 	  struct bfd_symbol *sym = in->outsymbols[i];