[PATCH] Avoid divide by zero when reading invalid PDB archive
Mark Harmstone
mark@harmstone.com
Fri Sep 16 00:40:34 GMT 2022
As discovered by Alan Modra - see
https://sourceware.org/pipermail/binutils/2022-September/122878.html.
---
bfd/pdb.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/bfd/pdb.c b/bfd/pdb.c
index 9a431c23b1f..0ce3bc46ac6 100644
--- a/bfd/pdb.c
+++ b/bfd/pdb.c
@@ -80,6 +80,12 @@ pdb_get_elt_at_index (bfd *abfd, symindex sym_index)
block_size = bfd_getl32 (int_buf);
+ if (block_size == 0)
+ {
+ bfd_set_error (bfd_error_malformed_archive);
+ return NULL;
+ }
+
/* Get block_map_addr. */
if (bfd_seek (abfd, 4 * sizeof (uint32_t), SEEK_CUR))
--
2.35.1
More information about the Binutils
mailing list