From: Nick Clifton Date: Mon, 24 Jul 2017 13:04:04 +0000 (+0100) Subject: Fix another memory access error triggered by attempting to parse a corrupt binary. X-Git-Tag: hjl/gpoff-backup~159 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=8a2df5e2df374289e00ecd8f099eb46d76ef982e;p=thirdparty%2Fbinutils-gdb.git 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 --git a/bfd/ChangeLog b/bfd/ChangeLog index a854a1266e1..9ae5da99ebe 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 PR 21803 diff --git a/bfd/vms-alpha.c b/bfd/vms-alpha.c index 5e9170d7b1b..610b034ccd0 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);