Skip to content

Commit

Permalink
x86: fix a race condition made by a static variable initialization. b…
Browse files Browse the repository at this point in the history
…ug reported by Xiaozhu Meng
  • Loading branch information
aquynh committed Jun 19, 2019
1 parent c602427 commit 30bffad
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions arch/X86/X86DisassemblerDecoder.c
Original file line number Diff line number Diff line change
Expand Up @@ -159,11 +159,8 @@ static InstrUID decode(OpcodeType type,
uint8_t modRM)
{
const struct ModRMDecision *dec = NULL;
static unsigned int index = -1;
static struct OpcodeDecision emptyDecision;

if (index == -1)
memset((void *)&emptyDecision, 0, sizeof(emptyDecision));
unsigned int index;
static struct OpcodeDecision emptyDecision = { 0 };

switch (type) {
default: break; // never reach
Expand Down

0 comments on commit 30bffad

Please sign in to comment.