commit cd3ea7c69acc5045eb28f9bf80d923116e15e4f5
Author: Nick Clifton <nickc@redhat.com>
Date:   Thu Jun 15 13:26:54 2017 +0100

    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.

Upstream-Status: Backport

CVE: CVE-2017-9756
Signed-off-by: Thiruvadi Rajaraman <trajaraman@mvista.com>

Index: git/opcodes/aarch64-dis.c
===================================================================
--- git.orig/opcodes/aarch64-dis.c	2017-09-21 15:48:27.154646380 +0530
+++ git/opcodes/aarch64-dis.c	2017-09-21 15:48:27.134646104 +0530
@@ -381,6 +381,9 @@
   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;
Index: git/opcodes/ChangeLog
===================================================================
--- git.orig/opcodes/ChangeLog	2017-09-21 15:45:32.264491166 +0530
+++ git/opcodes/ChangeLog	2017-09-21 15:49:53.751803571 +0530
@@ -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  H.J. Lu  <hongjiu.lu@intel.com>
 
 	PR binutils/21594
