asan: segfault in coff_mangle_symbols
authorAlan Modra <amodra@gmail.com>
Mon, 24 Apr 2023 01:49:15 +0000 (11:19 +0930)
committerAlan Modra <amodra@gmail.com>
Mon, 24 Apr 2023 11:29:38 +0000 (20:59 +0930)
commit2043ddb2185096eadc111865f31a70d1cffd6f4c
treea3a94741037461f71651abb7d1a3a2f6f559228f
parentc1eb3cd205921fb7af668f2032ab2c7142c4f24c
asan: segfault in coff_mangle_symbols

The testcase managed to trigger creation of a wild pointer in
coff_slurp_symbol_table.  Stop that happening, and fix an unrelated
problem I happened to see in bfd_coff_get_syment.

* coff-bfd.c (bfd_coff_get_syment): Clear fix_value after
converting n_value from a pointer to an index.
* coffcode.h (coff_slurp_symbol_table <C_BSTAT>): Sanity check
symbol value before converting to a pointer.
bfd/coff-bfd.c
bfd/coffcode.h