From f07af43e36ba563e64297d71af3f702ee47ba665 Mon Sep 17 00:00:00 2001 From: "H.J. Lu" Date: Fri, 16 Apr 2010 21:35:24 +0000 Subject: [PATCH] Return bad_opcode on unknown bits in opcode. 2010-04-16 H.J. Lu * i386-dis.c (get_valid_dis386): Return bad_opcode on unknown bits in opcode. --- opcodes/ChangeLog | 5 +++++ opcodes/i386-dis.c | 22 +++++++++++++++++----- 2 files changed, 22 insertions(+), 5 deletions(-) diff --git a/opcodes/ChangeLog b/opcodes/ChangeLog index 1e5b4de2c40..b686fe056a4 100644 --- a/opcodes/ChangeLog +++ b/opcodes/ChangeLog @@ -1,3 +1,8 @@ +2010-04-16 H.J. Lu + + * i386-dis.c (get_valid_dis386): Return bad_opcode on unknown + bits in opcode. + 2010-04-09 Nick Clifton * i386-dis.c (print_insn): Remove unused variable op. diff --git a/opcodes/i386-dis.c b/opcodes/i386-dis.c index 797d0bd700a..e5b45a1b909 100644 --- a/opcodes/i386-dis.c +++ b/opcodes/i386-dis.c @@ -11058,7 +11058,9 @@ get_valid_dis386 (const struct dis386 *dp, disassemble_info *info) switch ((*codep & 0x1f)) { default: - BadOp (); + dp = &bad_opcode; + return dp; + break; case 0x8: vex_table_index = XOP_08; break; @@ -11077,7 +11079,10 @@ get_valid_dis386 (const struct dis386 *dp, disassemble_info *info) vex.register_specifier = (~(*codep >> 3)) & 0xf; if (address_mode != mode_64bit && vex.register_specifier > 0x7) - BadOp (); + { + dp = &bad_opcode; + return dp; + } vex.length = (*codep & 0x4) ? 256 : 128; switch ((*codep & 0x3)) @@ -11115,7 +11120,8 @@ get_valid_dis386 (const struct dis386 *dp, disassemble_info *info) switch ((*codep & 0x1f)) { default: - BadOp (); + dp = &bad_opcode; + return dp; case 0x1: vex_table_index = VEX_0F; break; @@ -11134,7 +11140,10 @@ get_valid_dis386 (const struct dis386 *dp, disassemble_info *info) vex.register_specifier = (~(*codep >> 3)) & 0xf; if (address_mode != mode_64bit && vex.register_specifier > 0x7) - BadOp (); + { + dp = &bad_opcode; + return dp; + } vex.length = (*codep & 0x4) ? 256 : 128; switch ((*codep & 0x3)) @@ -11176,7 +11185,10 @@ get_valid_dis386 (const struct dis386 *dp, disassemble_info *info) vex.register_specifier = (~(*codep >> 3)) & 0xf; if (address_mode != mode_64bit && vex.register_specifier > 0x7) - BadOp (); + { + dp = &bad_opcode; + return dp; + } vex.w = 0; -- 2.30.2