diff options
author | Alan Modra <amodra@gmail.com> | 2023-08-28 21:07:52 +0930 |
---|---|---|
committer | Alan Modra <amodra@gmail.com> | 2023-08-28 23:10:57 +0930 |
commit | daafebb58dac3de93ac4696dd334530b762ed67f (patch) | |
tree | 24baa1ec2258e5751a1beb2d0c26fe2664a45063 /bfd/coffswap.h | |
parent | 54d57acf610e5db2e70afa234fd4018207606774 (diff) | |
download | gdb-daafebb58dac3de93ac4696dd334530b762ed67f.zip gdb-daafebb58dac3de93ac4696dd334530b762ed67f.tar.gz gdb-daafebb58dac3de93ac4696dd334530b762ed67f.tar.bz2 |
COFF swap_aux_in
A low level function like coff_swap_aux_in really has no business
concatenating multiple auxents for the old PE multi-aux scheme of
handling long file names. In doing so, it assumes multiple internal
auxent buffers are available, which they are not in most calls to
bfd_coff_swap_aux_in, both inside BFD and outside, eg. GDB. Buffer
overflow fun. Concatenating multiple auxents belongs at a higher
level.
This required some changes to coff_get_normalized_symtab, which now
uses the external auxents to access the concatenated file name.
(Internal auxents are larger than the x_fname array, so the pieces of
the file name are not adjacent as they are in the external auxents.)
* coffswap.h (coff_swap_aux_in): Do not write more than one
internal auxent.
* coffcode.h (coff_bigobj_swap_aux_in): Likewise.
* coffgen.c (coff_get_normalized_symtab): Normalize strings
after swapping in each symbol so that external auxents are
available. Use external auxents for multi-aux long file
names. Formatting. Wrap long lines. Remove excess parens
and unnecessary casts. Don't zalloc when only the string
terminator needs zeroing, and memcpy rather than strncpy.
Delete unnecessary sanity check with unsigned _n_offset.
Return with failure if debug section can't be read, to avoid
trying to read it multiple times. Correct sanity check
against debug section size.
Diffstat (limited to 'bfd/coffswap.h')
-rw-r--r-- | bfd/coffswap.h | 13 |
1 files changed, 3 insertions, 10 deletions
diff --git a/bfd/coffswap.h b/bfd/coffswap.h index 190b8f0..f0677ff8 100644 --- a/bfd/coffswap.h +++ b/bfd/coffswap.h @@ -402,8 +402,8 @@ coff_swap_aux_in (bfd *abfd, void * ext1, int type, int in_class, - int indx, - int numaux, + int indx ATTRIBUTE_UNUSED, + int numaux ATTRIBUTE_UNUSED, void * in1) { AUXENT *ext = (AUXENT *) ext1; @@ -426,14 +426,7 @@ coff_swap_aux_in (bfd *abfd, #if FILNMLEN != E_FILNMLEN #error we need to cope with truncating or extending FILNMLEN #else - if (numaux > 1 && obj_pe (abfd)) - { - if (indx == 0) - memcpy (in->x_file.x_n.x_fname, ext->x_file.x_fname, - numaux * sizeof (AUXENT)); - } - else - memcpy (in->x_file.x_n.x_fname, ext->x_file.x_fname, FILNMLEN); + memcpy (in->x_file.x_n.x_fname, ext->x_file.x_fname, FILNMLEN); #endif } goto end; |