[all-commits] [llvm/llvm-project] 64a93a: [X86][Disassembler] Fix a bug when disassembling a...

Fangrui Song via All-commits all-commits at lists.llvm.org
Mon Jan 13 10:42:27 PST 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: 64a93afc3c630c39e5c583e4f67aef5821d635b6
      https://github.com/llvm/llvm-project/commit/64a93afc3c630c39e5c583e4f67aef5821d635b6
  Author: Fangrui Song <maskray at google.com>
  Date:   2020-01-13 (Mon, 13 Jan 2020)

  Changed paths:
    M llvm/lib/Target/X86/Disassembler/X86Disassembler.cpp
    M llvm/unittests/MC/Disassembler.cpp

  Log Message:
  -----------
  [X86][Disassembler] Fix a bug when disassembling an empty string

readPrefixes() assumes insn->bytes is non-empty. The code path is not
exercised in llvm-mc because llvm-mc does not feed empty input to
MCDisassembler::getInstruction().

This bug is uncovered by a5994c789a2982a770254ae1607b5b4cb641f73c.
An empty string did not crash before because the deleted regionReader()
allowed UINT64_C(-1) as insn->readerCursor.

  Bytes.size() <= Address -> R->Base
  0 <= UINT64_C(-1) - UINT32_C(-1)




More information about the All-commits mailing list