浏览代码

LibX86: Make Instruction::length work for invalid instructions

Simon Wanner 3 年之前
父节点
当前提交
c5681e06c6
共有 1 个文件被更改,包括 2 次插入1 次删除
  1. 2 1
      Userland/Libraries/LibX86/Instruction.h

+ 2 - 1
Userland/Libraries/LibX86/Instruction.h

@@ -872,7 +872,7 @@ ALWAYS_INLINE unsigned Instruction::length() const
     unsigned len = 1;
     unsigned len = 1;
     if (has_sub_op())
     if (has_sub_op())
         ++len;
         ++len;
-    if (m_descriptor->has_rm) {
+    if (m_descriptor && m_descriptor->has_rm) {
         ++len;
         ++len;
         if (m_modrm.m_has_sib)
         if (m_modrm.m_has_sib)
             ++len;
             ++len;
@@ -993,6 +993,7 @@ ALWAYS_INLINE Instruction::Instruction(InstructionStreamType& stream, OperandSiz
                 warnln("Instruction {:02X} not understood", m_op);
                 warnln("Instruction {:02X} not understood", m_op);
         }
         }
         m_descriptor = nullptr;
         m_descriptor = nullptr;
+        m_extra_bytes = prefix_bytes;
         return;
         return;
     }
     }