This is the mail archive of the
binutils-cvs@sourceware.org
mailing list for the binutils project.
[binutils-gdb] Fix another memory access error triggered by attempting to parse a corrupt binary.
- From: Nick Clifton <nickc at sourceware dot org>
- To: bfd-cvs at sourceware dot org
- Date: 24 Jul 2017 13:04:49 -0000
- Subject: [binutils-gdb] Fix another memory access error triggered by attempting to parse a corrupt binary.
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=8a2df5e2df374289e00ecd8f099eb46d76ef982e
commit 8a2df5e2df374289e00ecd8f099eb46d76ef982e
Author: Nick Clifton <nickc@redhat.com>
Date: Mon Jul 24 14:04:04 2017 +0100
Fix another memory access error triggered by attempting to parse a corrupt binary.
PR 21813
(alpha_vms_object_p): Check for a truncated record.
Diff:
---
bfd/ChangeLog | 2 ++
bfd/vms-alpha.c | 3 +++
2 files changed, 5 insertions(+)
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index a854a12..9ae5da9 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -22,6 +22,8 @@
(image_set_ptr): Likewise.
(alpha_vms_slurp_relocs): Likewise.
+ (alpha_vms_object_p): Check for a truncated record.
+
2017-07-24 Nick Clifton <nickc@redhat.com>
PR 21803
diff --git a/bfd/vms-alpha.c b/bfd/vms-alpha.c
index 5e9170d..610b034 100644
--- a/bfd/vms-alpha.c
+++ b/bfd/vms-alpha.c
@@ -2679,6 +2679,9 @@ alpha_vms_object_p (bfd *abfd)
PRIV (recrd.buf_size) = PRIV (recrd.rec_size);
}
+ /* PR 21813: Check for a truncated record. */
+ if (PRIV (recrd.rec_size < test_len))
+ goto error_ret;
/* Read the remaining record. */
remaining = PRIV (recrd.rec_size) - test_len;
to_read = MIN (VMS_BLOCK_SIZE - test_len, remaining);