forked from Imagelibrary/binutils-gdb
PR25961, buffer overflow in coff_swap_aux_in
PR 25961 * coffgen.c (coff_get_normalized_symtab): Check that buffer contains required number of auxents before processing any auxent. * coffswap.h (coff_swap_aux_in <C_FILE>): Only swap in extended file name from auxents for PE.
This commit is contained in:
@@ -1818,6 +1818,13 @@ coff_get_normalized_symtab (bfd *abfd)
|
||||
symbol_ptr = internal_ptr;
|
||||
internal_ptr->is_sym = TRUE;
|
||||
|
||||
/* PR 17512: Prevent buffer overrun. */
|
||||
if (symbol_ptr->u.syment.n_numaux > (raw_end - raw_src) / symesz)
|
||||
{
|
||||
bfd_release (abfd, internal);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
for (i = 0;
|
||||
i < symbol_ptr->u.syment.n_numaux;
|
||||
i++)
|
||||
@@ -1825,13 +1832,6 @@ coff_get_normalized_symtab (bfd *abfd)
|
||||
internal_ptr++;
|
||||
raw_src += symesz;
|
||||
|
||||
/* PR 17512: Prevent buffer overrun. */
|
||||
if (raw_src >= raw_end || internal_ptr >= internal_end)
|
||||
{
|
||||
bfd_release (abfd, internal);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
bfd_coff_swap_aux_in (abfd, (void *) raw_src,
|
||||
symbol_ptr->u.syment.n_type,
|
||||
symbol_ptr->u.syment.n_sclass,
|
||||
|
||||
Reference in New Issue
Block a user