mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-22 07:30:19 +00:00
LibX86: Make Instruction::length work for invalid instructions
This commit is contained in:
parent
ab1f28d566
commit
c5681e06c6
Notes:
sideshowbarker
2024-07-17 04:02:16 +09:00
Author: https://github.com/skyrising Commit: https://github.com/SerenityOS/serenity/commit/c5681e06c6 Pull-request: https://github.com/SerenityOS/serenity/pull/15465 Reviewed-by: https://github.com/ADKaster ✅ Reviewed-by: https://github.com/Hendiadyoin1
1 changed files with 2 additions and 1 deletions
|
@ -872,7 +872,7 @@ ALWAYS_INLINE unsigned Instruction::length() const
|
|||
unsigned len = 1;
|
||||
if (has_sub_op())
|
||||
++len;
|
||||
if (m_descriptor->has_rm) {
|
||||
if (m_descriptor && m_descriptor->has_rm) {
|
||||
++len;
|
||||
if (m_modrm.m_has_sib)
|
||||
++len;
|
||||
|
@ -993,6 +993,7 @@ ALWAYS_INLINE Instruction::Instruction(InstructionStreamType& stream, OperandSiz
|
|||
warnln("Instruction {:02X} not understood", m_op);
|
||||
}
|
||||
m_descriptor = nullptr;
|
||||
m_extra_bytes = prefix_bytes;
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue