[PATCH] D54138: [WebAssembly] Read prefixed opcodes as ULEB128s

Thomas Lively via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Nov 9 11:05:41 PST 2018


tlively added inline comments.


================
Comment at: llvm/trunk/lib/Target/WebAssembly/Disassembler/WebAssemblyDisassembler.cpp:141
+      return MCDisassembler::Fail;
+    if (PrefixedOpc < 0 || PrefixedOpc >= WebAssemblyInstructionTableSize)
       return MCDisassembler::Fail;
----------------
aardappel wrote:
> wait.. the extension opcode is a LEB, yet has max 256 possible values?
This is true currently, which led me to open https://github.com/WebAssembly/simd/issues/46. However, in the future we might have more than 265 SIMD opcodes, in which case we could just bump WebAssemblyInstructionTableSize in the TableGen backend and have everything just work. This check just makes sure that bad input cannot cause us to read past the end of the disassembler tables. 


Repository:
  rL LLVM

https://reviews.llvm.org/D54138





More information about the llvm-commits mailing list