Prevent address violation problem when disassembling corrupt aarch64 binary.
authorNick Clifton <nickc@redhat.com>
Thu, 15 Jun 2017 12:26:54 +0000 (13:26 +0100)
committerNick Clifton <nickc@redhat.com>
Thu, 15 Jun 2017 12:26:54 +0000 (13:26 +0100)
PR binutils/21595
* aarch64-dis.c (aarch64_ext_ldst_reglist): Check for an out of
range value.

opcodes/ChangeLog
opcodes/aarch64-dis.c

index c77f00a979254011dc37d39df8df30fdaeee8e35..e489d4367507c4514b671529f1151e4ef59c3053 100644 (file)
@@ -1,3 +1,9 @@
+2017-06-15  Nick Clifton  <nickc@redhat.com>
+
+       PR binutils/21595
+       * aarch64-dis.c (aarch64_ext_ldst_reglist): Check for an out of
+       range value.
+
 2017-06-15  Nick Clifton  <nickc@redhat.com>
 
        PR binutils/21588
index 27ef22bc09f1ca29aa69f43be3c02a692ae391c3..a860dbcb003378f2717f236b72fdc60484783d72 100644 (file)
@@ -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;