A failure to decode the instruction can cause a NULL pointer access. This is fixed simply by moving the "done" label as close as possible to the return. This fixes CVE-2014-8481.
Unified · Split
| @@ -4580,10 +4580,10 @@ done_prefixes: · 4579 unmodified lines | |||
| 4580 | /* Decode and fetch the destination operand: register or memory. */ | 4580 | /* Decode and fetch the destination operand: register or memory. */ |
| 4581 | rc = decode_operand(ctxt, &ctxt->dst, (ctxt->d >> DstShift) & OpMask); | 4581 | rc = decode_operand(ctxt, &ctxt->dst, (ctxt->d >> DstShift) & OpMask); |
| 4582 | 4582 | ||
| 4583 | done: | ||
| 4584 | if (ctxt->rip_relative) | 4583 | if (ctxt->rip_relative) |
| 4585 | ctxt->memopp->addr.mem.ea += ctxt->_eip; | 4584 | ctxt->memopp->addr.mem.ea += ctxt->_eip; |
| 4586 | 4585 | ||
| 4586 | done: | ||
| 4587 | return (rc != X86EMUL_CONTINUE) ? EMULATION_FAILED : EMULATION_OK; | 4587 | return (rc != X86EMUL_CONTINUE) ? EMULATION_FAILED : EMULATION_OK; |
| 4588 | } | 4588 | } |
| 4589 | 4589 | ||