Fix another memory access error triggered by attempting to parse a corrupt binary.

PR 21813
	(alpha_vms_object_p): Check for a truncated record.
This commit is contained in:
Nick Clifton 2017-07-24 14:04:04 +01:00
parent ca4cf9b9c6
commit 8a2df5e2df
2 changed files with 5 additions and 0 deletions

View File

@ -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

View File

@ -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);