mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-06-20 09:58:19 +08:00
Check thin archive element file size against archive header
Makes it a little less likely for someone to break their thin archives. * archive.c (_bfd_get_elt_at_filepos): Check thin archive element file size.
This commit is contained in:
@ -717,7 +717,17 @@ _bfd_get_elt_at_filepos (bfd *archive, file_ptr filepos,
|
||||
open the external file as a bfd. */
|
||||
bfd_set_error (bfd_error_no_error);
|
||||
n_bfd = open_nested_file (filename, archive);
|
||||
if (n_bfd == NULL)
|
||||
if (n_bfd != NULL)
|
||||
{
|
||||
ufile_ptr size = bfd_get_size (n_bfd);
|
||||
if (size != 0 && size != new_areldata->parsed_size)
|
||||
{
|
||||
bfd_set_error (bfd_error_malformed_archive);
|
||||
bfd_close (n_bfd);
|
||||
n_bfd = NULL;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
switch (bfd_get_error ())
|
||||
{
|
||||
|
Reference in New Issue
Block a user