diff options
author | Alan Modra <amodra@gmail.com> | 2024-02-28 18:53:52 +1030 |
---|---|---|
committer | Alan Modra <amodra@gmail.com> | 2024-02-28 21:24:39 +1030 |
commit | 4b72a278f46245635ca03ffc8179570c07e3531a (patch) | |
tree | 7eb6aecba05182c1014f039e0f2e3d1e60717f5a /bfd/libaout.h | |
parent | 4e0d61241012e3ae0c79603d6b6871b3407a976f (diff) | |
download | gdb-4b72a278f46245635ca03ffc8179570c07e3531a.zip gdb-4b72a278f46245635ca03ffc8179570c07e3531a.tar.gz gdb-4b72a278f46245635ca03ffc8179570c07e3531a.tar.bz2 |
PR23881, pdp11 binutils fails if too much debug data
The PR testcase overflows one of the exec header fields, e_syms (the
size of the symbol table), leading to the string table offset being
wrong. Things go downhill from there. Fixed by checking for
overflow. This happens to trigger in the ld testsuite, so xfail that
test.
PR 23881
bfd/
* libaout.h (swap_exec_header_out): Return a bool.
* aoutx.h (swap_exec_header_out): Check for overflow in exec
header.
* pdp11.c (swap_exec_header_out): Likewise.
* i386lynx.c (WRITE_HEADERS): Adjust.
ld/
* testsuite/ld-scripts/map-address.exp: xfail pdp11.
Diffstat (limited to 'bfd/libaout.h')
-rw-r--r-- | bfd/libaout.h | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/bfd/libaout.h b/bfd/libaout.h index 11a6f70..91033d4 100644 --- a/bfd/libaout.h +++ b/bfd/libaout.h @@ -570,7 +570,7 @@ extern bool NAME (aout, adjust_sizes_and_vmas) extern void NAME (aout, swap_exec_header_in) (bfd *, struct external_exec *, struct internal_exec *); -extern void NAME (aout, swap_exec_header_out) +extern bool NAME (aout, swap_exec_header_out) (bfd *, struct internal_exec *, struct external_exec *); extern struct bfd_hash_entry * NAME (aout, link_hash_newfunc) @@ -631,7 +631,8 @@ extern bool NAME (aout, bfd_free_cached_info) * obj_reloc_entry_size (abfd)); \ execp->a_drsize = ((obj_datasec (abfd)->reloc_count) \ * obj_reloc_entry_size (abfd)); \ - NAME (aout, swap_exec_header_out) (abfd, execp, &exec_bytes); \ + if (!NAME (aout, swap_exec_header_out) (abfd, execp, &exec_bytes)) \ + return false; \ \ if (bfd_seek (abfd, 0, SEEK_SET) != 0 \ || bfd_write (&exec_bytes, EXEC_BYTES_SIZE, \ |