From: Nick Clifton Date: Thu, 15 Jun 2017 12:26:54 +0000 (+0100) Subject: Prevent address violation problem when disassembling corrupt aarch64 binary. X-Git-Url: http://drtracing.org/?a=commitdiff_plain;h=cd3ea7c69acc5045eb28f9bf80d923116e15e4f5;hp=62b76e4b6e0b4cb5b3e0053d1de4097b32577049;p=deliverable%2Fbinutils-gdb.git Prevent address violation problem when disassembling corrupt aarch64 binary. PR binutils/21595 * aarch64-dis.c (aarch64_ext_ldst_reglist): Check for an out of range value. --- diff --git a/opcodes/ChangeLog b/opcodes/ChangeLog index c77f00a979..e489d43675 100644 --- a/opcodes/ChangeLog +++ b/opcodes/ChangeLog @@ -1,3 +1,9 @@ +2017-06-15 Nick Clifton + + PR binutils/21595 + * aarch64-dis.c (aarch64_ext_ldst_reglist): Check for an out of + range value. + 2017-06-15 Nick Clifton PR binutils/21588 diff --git a/opcodes/aarch64-dis.c b/opcodes/aarch64-dis.c index 27ef22bc09..a860dbcb00 100644 --- a/opcodes/aarch64-dis.c +++ b/opcodes/aarch64-dis.c @@ -409,6 +409,9 @@ aarch64_ext_ldst_reglist (const aarch64_operand *self ATTRIBUTE_UNUSED, info->reglist.first_regno = extract_field (FLD_Rt, code, 0); /* opcode */ value = extract_field (FLD_opcode, code, 0); + /* PR 21595: Check for a bogus value. */ + if (value >= ARRAY_SIZE (data)) + return 0; if (expected_num != data[value].num_elements || data[value].is_reserved) return 0; info->reglist.num_regs = data[value].num_regs;