Fix undefined behaviour issue in capstone-x86

This commit is contained in:
pancake 2017-04-20 16:46:02 +02:00
parent e5cfb20adb
commit d692bfb37a

View File

@ -0,0 +1,20 @@
--- a/arch/X86/X86Disassembler.c.orig 2017-04-20 16:42:06.000000000 +0200
+++ b/arch/X86/X86Disassembler.c 2017-04-20 16:42:51.000000000 +0200
@@ -901,7 +901,7 @@
MCInst *instr, uint16_t *size, uint64_t address, void *_info)
{
cs_struct *handle = (cs_struct *)(uintptr_t)ud;
- InternalInstruction insn;
+ InternalInstruction insn = {0};
struct reader_info info;
int ret;
bool result;
@@ -910,8 +910,6 @@
info.size = code_len;
info.offset = address;
- memset(&insn, 0, offsetof(InternalInstruction, reader));
-
if (instr->flat_insn->detail) {
instr->flat_insn->detail->x86.op_count = 0;
instr->flat_insn->detail->x86.sse_cc = X86_SSE_CC_INVALID;