aboutsummaryrefslogtreecommitdiff
path: root/bfd/bfdio.c
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2020-08-26 11:32:51 +0930
committerAlan Modra <amodra@gmail.com>2020-08-26 23:23:44 +0930
commitc01de193638c9022411ae0542a457b9d68723013 (patch)
treeab3bc7872a0fd54bd39f11198d2e29168b89ff8a /bfd/bfdio.c
parentb4e125d9351f84233698bef91530743547c87403 (diff)
downloadgdb-c01de193638c9022411ae0542a457b9d68723013.zip
gdb-c01de193638c9022411ae0542a457b9d68723013.tar.gz
gdb-c01de193638c9022411ae0542a457b9d68723013.tar.bz2
asan: alpha-vms: mmember access within null pointer
* bfdio.c (bfd_get_file_size): Don't segv on NULL adata.
Diffstat (limited to 'bfd/bfdio.c')
-rw-r--r--bfd/bfdio.c18
1 files changed, 11 insertions, 7 deletions
diff --git a/bfd/bfdio.c b/bfd/bfdio.c
index 5f144bc..86b696b 100644
--- a/bfd/bfdio.c
+++ b/bfd/bfdio.c
@@ -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);