asan: alpha-vms: mmember access within null pointer

* bfdio.c (bfd_get_file_size): Don't segv on NULL adata.
This commit is contained in:
Alan Modra 2020-08-26 11:32:51 +09:30
parent b4e125d935
commit c01de19363
2 changed files with 15 additions and 7 deletions

View File

@ -1,3 +1,7 @@
2020-08-26 Alan Modra <amodra@gmail.com>
* bfdio.c (bfd_get_file_size): Don't segv on NULL adata.
2020-08-26 Alan Modra <amodra@gmail.com>
PR 26415

View File

@ -493,13 +493,17 @@ bfd_get_file_size (bfd *abfd)
&& !bfd_is_thin_archive (abfd->my_archive))
{
struct areltdata *adata = (struct areltdata *) abfd->arelt_data;
archive_size = adata->parsed_size;
/* If the archive is compressed we can't compare against file size. */
if (adata->arch_header != NULL
&& memcmp (((struct ar_hdr *) adata->arch_header)->ar_fmag,
"Z\012", 2) == 0)
return archive_size;
abfd = abfd->my_archive;
if (adata != NULL)
{
archive_size = adata->parsed_size;
/* If the archive is compressed we can't compare against
file size. */
if (adata->arch_header != NULL
&& memcmp (((struct ar_hdr *) adata->arch_header)->ar_fmag,
"Z\012", 2) == 0)
return archive_size;
abfd = abfd->my_archive;
}
}
file_size = bfd_get_size (abfd);