i386-dis: Check valid bnd register
authorH.J. Lu <hjl.tools@gmail.com>
Thu, 15 Jun 2017 13:40:17 +0000 (06:40 -0700)
committerH.J. Lu <hjl.tools@gmail.com>
Thu, 15 Jun 2017 13:40:17 +0000 (06:40 -0700)
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.

opcodes/ChangeLog
opcodes/i386-dis.c

index e489d4367507c4514b671529f1151e4ef59c3053..008956a8e018cf6e5e467ca2be4ecd076092c920 100644 (file)
@@ -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/21595
 2017-06-15  Nick Clifton  <nickc@redhat.com>
 
        PR binutils/21595
index b35dbc046ee0dda4db472230a07a186ecf786e70..d461d0859447dae9ed46320b7d6cd775704c6c67 100644 (file)
@@ -15025,6 +15025,11 @@ OP_E_register (int bytemode, int sizeflag)
       names = address_mode == mode_64bit ? names64 : names32;
       break;
     case bnd_mode:
       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:
       names = names_bnd;
       break;
     case indir_v_mode:
@@ -15569,6 +15574,11 @@ OP_G (int bytemode, int sizeflag)
       oappend (names64[modrm.reg + add]);
       break;
     case bnd_mode:
       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:
       oappend (names_bnd[modrm.reg]);
       break;
     case v_mode:
This page took 0.03067 seconds and 4 git commands to generate.