commit 0d96e4df4812c3bad77c229dfef47a9bc115ac12
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Thu Jun 15 06:40:17 2017 -0700

    i386-dis: Check valid bnd register
    
    Since there are only 4 bnd registers, return "(bad)" for register
    number > 3.
    
    	PR binutils/21594
    	* i386-dis.c (OP_E_register): Check valid bnd register.
    	(OP_G): Likewise.

Upstream-Status: Backport

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

Index: git/opcodes/i386-dis.c
===================================================================
--- git.orig/opcodes/i386-dis.c	2017-09-21 15:38:46.907182525 +0530
+++ git/opcodes/i386-dis.c	2017-09-21 15:38:54.703174976 +0530
@@ -15211,6 +15211,11 @@
       names = address_mode == mode_64bit ? names64 : names32;
       break;
     case bnd_mode:
+      if (reg > 0x3)
+	{
+	  oappend ("(bad)");
+	  return;
+	}
       names = names_bnd;
       break;
     case indir_v_mode:
@@ -15751,6 +15756,11 @@
       oappend (names64[modrm.reg + add]);
       break;
     case bnd_mode:
+      if (modrm.reg > 0x3)
+	{
+	  oappend ("(bad)");
+	  return;
+	}
       oappend (names_bnd[modrm.reg]);
       break;
     case v_mode:
Index: git/opcodes/ChangeLog
===================================================================
--- git.orig/opcodes/ChangeLog	2017-09-21 15:38:54.531175122 +0530
+++ git/opcodes/ChangeLog	2017-09-21 15:45:32.264491166 +0530
@@ -1,3 +1,9 @@
+2017-06-15  H.J. Lu  <hongjiu.lu@intel.com>
+
+	PR binutils/21594
+	* i386-dis.c (OP_E_register): Check valid bnd register.
+	(OP_G): Likewise.
+
 2017-06-15  Nick Clifton  <nickc@redhat.com>
 
 	PR binutils/21586
