]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
asan: alpha-vms: mmember access within null pointer
authorAlan Modra <amodra@gmail.com>
Wed, 26 Aug 2020 02:02:51 +0000 (11:32 +0930)
committerAlan Modra <amodra@gmail.com>
Wed, 26 Aug 2020 13:53:44 +0000 (23:23 +0930)
* bfdio.c (bfd_get_file_size): Don't segv on NULL adata.

bfd/ChangeLog
bfd/bfdio.c

index fe440e89c6be7fe850214d88b1f7bf8ce3a5b013..c296f6d89a38f20ee9b90b5b463451c7402fad8e 100644 (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
index 5f144bc7f3fee833ff97924ec8f2e3eec37364b9..86b696bba9cc0884131924af2a97f188e0686d81 100644 (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);