aboutsummaryrefslogtreecommitdiff
path: root/bfd/som.c
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2022-11-23 22:12:30 +1030
committerAlan Modra <amodra@gmail.com>2022-11-23 22:38:48 +1030
commite6b6fad2fe4d180bcd65a1e0aabc6ba763901346 (patch)
treebc1ceb0e32d8f6a15365185e2947bc6d724dd0e0 /bfd/som.c
parentd499fb89448c3f2e061813f12a1b63fbaa29422e (diff)
downloadgdb-e6b6fad2fe4d180bcd65a1e0aabc6ba763901346.zip
gdb-e6b6fad2fe4d180bcd65a1e0aabc6ba763901346.tar.gz
gdb-e6b6fad2fe4d180bcd65a1e0aabc6ba763901346.tar.bz2
PR22509 - Null pointer dereference on coff_slurp_reloc_table
This extends the commit 4581a1c7d304 fix to more targets, which hardens BFD a little. I think the real underlying problem was the bfd_canonicalize_reloc call in load_specific_debug_section which passed a NULL for "symbols". Fix that too. PR 22509 bfd/ * aoutx.h (swap_ext_reloc_out): Gracefully handle NULL symbols. * i386lynx.c (swap_ext_reloc_out): Likewise. * pdp11.c (pdp11_aout_swap_reloc_out): Likewise. * coff-tic30.c (reloc_processing): Likewise. * coff-tic4x.c (tic4x_reloc_processing): Likewise. * coff-tic54x.c (tic54x_reloc_processing): Likewise. * coff-z80.c (reloc_processing): Likewise. * coff-z8k.c (reloc_processing): Likewise. * ecoff.c (ecoff_slurp_reloc_table): Likewise. * som.c (som_set_reloc_info): Likewise. binutils/ * objdump.c (load_specific_debug_section): Pass syms to bfd_canonicalize_reloc.
Diffstat (limited to 'bfd/som.c')
-rw-r--r--bfd/som.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/bfd/som.c b/bfd/som.c
index 7a5ee35..3e89c93 100644
--- a/bfd/som.c
+++ b/bfd/som.c
@@ -5099,7 +5099,7 @@ som_set_reloc_info (unsigned char *fixup,
/* A symbol to use in the relocation. Make a note
of this if we are not just counting. */
case 'S':
- if (! just_count && (unsigned int) c < symcount)
+ if (!just_count && symbols != NULL && (unsigned int) c < symcount)
rptr->sym_ptr_ptr = &symbols[c];
break;
/* Argument relocation bits for a function call. */