diff options
author | Alan Modra <amodra@gmail.com> | 2020-08-26 11:32:51 +0930 |
---|---|---|
committer | Alan Modra <amodra@gmail.com> | 2020-08-26 23:23:44 +0930 |
commit | c01de193638c9022411ae0542a457b9d68723013 (patch) | |
tree | ab3bc7872a0fd54bd39f11198d2e29168b89ff8a /bfd | |
parent | b4e125d9351f84233698bef91530743547c87403 (diff) | |
download | gdb-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')
-rw-r--r-- | bfd/ChangeLog | 4 | ||||
-rw-r--r-- | bfd/bfdio.c | 18 |
2 files changed, 15 insertions, 7 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog index fe440e8..c296f6d 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,5 +1,9 @@ 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 * vms-misc.c (vms_time_t_to_vms_time): Don't use unsigned short vars. 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); |