aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2022-06-02 16:31:42 +0930
committerAlan Modra <amodra@gmail.com>2022-06-02 16:31:42 +0930
commitf66d30a6e5b9287f9edaa93e9f04db1fd44a06ce (patch)
tree6d25eb663209555f9933e7dd6b39d04ff52b8349
parente0ad09cfa5f0672ee917de2c56a27427e6908220 (diff)
downloadgdb-f66d30a6e5b9287f9edaa93e9f04db1fd44a06ce.zip
gdb-f66d30a6e5b9287f9edaa93e9f04db1fd44a06ce.tar.gz
gdb-f66d30a6e5b9287f9edaa93e9f04db1fd44a06ce.tar.bz2
asan: null deref in coff_write_relocs
* coffcode.h (coff_write_relocs): Don't deref NULL howto.
-rw-r--r--bfd/coffcode.h6
1 files changed, 4 insertions, 2 deletions
diff --git a/bfd/coffcode.h b/bfd/coffcode.h
index 36e0702..6de6ecd 100644
--- a/bfd/coffcode.h
+++ b/bfd/coffcode.h
@@ -2690,9 +2690,11 @@ coff_write_relocs (bfd * abfd, int first_undef)
#ifdef SELECT_RELOC
/* Work out reloc type from what is required. */
- SELECT_RELOC (n, q->howto);
+ if (q->howto)
+ SELECT_RELOC (n, q->howto);
#else
- n.r_type = q->howto->type;
+ if (q->howto)
+ n.r_type = q->howto->type;
#endif
coff_swap_reloc_out (abfd, &n, &dst);