From 075ccadbe98b3137778005e0ad80432f5b8d9e8d Mon Sep 17 00:00:00 2001 From: Nguyen Anh Quynh Date: Sun, 3 Jan 2016 08:25:51 +0700 Subject: [PATCH] x86: set s->pc in disas_insn() early to fix uninitialized read issue. bug reported by @farmdve --- qemu/target-i386/translate.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/qemu/target-i386/translate.c b/qemu/target-i386/translate.c index d661a007..285ba32c 100644 --- a/qemu/target-i386/translate.c +++ b/qemu/target-i386/translate.c @@ -4751,6 +4751,8 @@ static target_ulong disas_insn(CPUX86State *env, DisasContext *s, bool changed_cc_op = false; + s->pc = pc_start; + // end address tells us to stop emulation if (s->pc == s->uc->addr_end) { // imitate the HLT instruction @@ -4781,7 +4783,6 @@ static target_ulong disas_insn(CPUX86State *env, DisasContext *s, } } - s->pc = pc_start; prefixes = 0; s->override = -1; rex_w = -1;