public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* [committed, PATCH] i386-dis: Check valid bnd register
@ 2017-06-15 13:42 H.J. Lu
  0 siblings, 0 replies; only message in thread
From: H.J. Lu @ 2017-06-15 13:42 UTC (permalink / raw)
  To: binutils

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  |  6 ++++++
 opcodes/i386-dis.c | 10 ++++++++++
 2 files changed, 16 insertions(+)

diff --git a/opcodes/ChangeLog b/opcodes/ChangeLog
index e489d43..008956a 100644
--- a/opcodes/ChangeLog
+++ b/opcodes/ChangeLog
@@ -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
diff --git a/opcodes/i386-dis.c b/opcodes/i386-dis.c
index b35dbc0..d461d08 100644
--- a/opcodes/i386-dis.c
+++ b/opcodes/i386-dis.c
@@ -15025,6 +15025,11 @@ OP_E_register (int bytemode, int sizeflag)
       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:
@@ -15569,6 +15574,11 @@ OP_G (int bytemode, int sizeflag)
       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:
-- 
2.9.4

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2017-06-15 13:42 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-06-15 13:42 [committed, PATCH] i386-dis: Check valid bnd register H.J. Lu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).