diff options
author | Alan Modra <amodra@gmail.com> | 2023-12-26 22:46:56 +1030 |
---|---|---|
committer | Alan Modra <amodra@gmail.com> | 2023-12-27 16:36:23 +1030 |
commit | 3bb1944a5a0527a38702084ac301d9933b0130bb (patch) | |
tree | 2582c76c696e90b536d58a279f6397190d0d8d8a /bfd/cpu-mep.c | |
parent | 145c21056abeace6b3f6cafb65c29a7812036852 (diff) | |
download | gdb-3bb1944a5a0527a38702084ac301d9933b0130bb.zip gdb-3bb1944a5a0527a38702084ac301d9933b0130bb.tar.gz gdb-3bb1944a5a0527a38702084ac301d9933b0130bb.tar.bz2 |
asan: buffer overflow in loongarch_elf_rtype_to_howto
Seen when running ld-loongarch-elf/tlsdesc-dso test.
elfxx-loongarch.c:1844:32: runtime error: index 125 out of bounds for
type 'loongarch_reloc_howto_type [124]'
So either the loongarch_howto_table needs three more
LOONGARCH_EMPTY_HOWTO entries, or loongarch_elf_rtype_to_howto should
be testing for r_type < ARRAY_SIZE (loongarch_howto_table). I figure
it's worth wasting a little more space to get faster lookup.
* elfxx-loongarch.c (loongarch_howto_table): Add
LOONGARCH_EMPTY_HOWTO entries for 121..123.
(loongarch_elf_rtype_to_howto): Don't support slow lookup.
Assert exact table size and r_type indexing. Omit return cast.
(loongarch_reloc_name_lookup): Omit assertion and return cast.
(loongarch_reloc_type_lookup): Likewise.
Diffstat (limited to 'bfd/cpu-mep.c')
0 files changed, 0 insertions, 0 deletions