Skip to content

[X86][MC] Reject out-of-range control and debug registers encoded with APX #82584

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions llvm/lib/Target/X86/Disassembler/X86Disassembler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -819,8 +819,12 @@ static int readModRM(struct InternalInstruction *insn) {
*valid = 0; \
return prefix##_ES + (index & 7); \
case TYPE_DEBUGREG: \
if (index > 15) \
*valid = 0; \
return prefix##_DR0 + index; \
case TYPE_CONTROLREG: \
if (index > 15) \
*valid = 0; \
return prefix##_CR0 + index; \
case TYPE_MVSIBX: \
return prefix##_XMM0 + index; \
Expand Down
4 changes: 4 additions & 0 deletions llvm/test/MC/Disassembler/X86/x86-64-err.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@
# 32: into
0xce

# 64: invalid instruction encoding
0xd5,0xc5,0x20,0xef
# 64: invalid instruction encoding
0xd5,0xc5,0x21,0xef
# 64: invalid instruction encoding
0xc4,0x62,0xf9,0x18,0x20
# 64: invalid instruction encoding
Expand Down