https://sourceware.org/bugzilla/show_bug.cgi?id=25831
Signed-off-by: Mark Wielaard <mark@klomp.org>
+2020-04-16 Mark Wielaard <mark@klomp.org>
+
+ * i386_disasm.c (i386_disasm): Replace assert with goto invalid_op
+ for bad prefix.
+
2019-12-11 Omar Sandoval <osandov@fb.com>
* Makefile.am (i386_lex_CFLAGS): Add -Wno-implicit-fallthrough.
++curr;
- assert (last_prefix_bit != 0);
+ if (last_prefix_bit == 0)
+ goto invalid_op;
correct_prefix = last_prefix_bit;
}
the input data. */
goto do_ret;
- assert (correct_prefix == 0
- || (prefixes & correct_prefix) != 0);
+ if (correct_prefix != 0 && (prefixes & correct_prefix) == 0)
+ goto invalid_op;
prefixes ^= correct_prefix;
if (0)
if (data == end)
{
- assert (prefixes != 0);
+ if (prefixes == 0)
+ goto invalid_op;
goto print_prefix;
}
}
/* Invalid (or at least unhandled) opcode. */
+ invalid_op:
if (prefixes != 0)
goto print_prefix;
/* Make sure we get past the unrecognized opcode if we haven't yet. */