Blob Blame History Raw
X-Git-Url: https://sourceware.org/git/?p=binutils-gdb.git;a=blobdiff_plain;f=bfd%2Felf.c;h=7cd7febcf954110e56bccdc8ab6e191a3fdd56c4;hp=fe00e0f91899acfa3c43e6780935604183698b2d;hb=5c831a3c7f3ca98d6aba1200353311e1a1f84c70;hpb=feab6abfe23b5b1724cb3c00059254e8f1bc5225

diff --git a/bfd/elf.c b/bfd/elf.c
index fe00e0f9189..7cd7febcf95 100644
--- a/bfd/elf.c
+++ b/bfd/elf.c
@@ -8918,7 +8918,9 @@ _bfd_elf_slurp_version_tables (bfd *abfd, bool default_imported_symver)
 	  bfd_set_error (bfd_error_file_too_big);
 	  goto error_return_verref;
 	}
-      elf_tdata (abfd)->verref = (Elf_Internal_Verneed *) bfd_alloc (abfd, amt);
+      if (amt == 0)
+	goto error_return_verref;
+      elf_tdata (abfd)->verref = (Elf_Internal_Verneed *) bfd_zalloc (abfd, amt);
       if (elf_tdata (abfd)->verref == NULL)
 	goto error_return_verref;