[PATCH] D105528: [RuntimeDyldChecker] Support offset in decode_operand expr

luxufan via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 21 01:44:48 PDT 2021


StephenFan updated this revision to Diff 360383.
StephenFan added a comment.

Fail fast when SymbolMem's size < Offset + instruction size


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D105528/new/

https://reviews.llvm.org/D105528

Files:
  llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldChecker.cpp


Index: llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldChecker.cpp
===================================================================
--- llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldChecker.cpp
+++ llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldChecker.cpp
@@ -688,6 +688,8 @@
                   int64_t Offset) const {
     MCDisassembler *Dis = Checker.Disassembler;
     StringRef SymbolMem = Checker.getSymbolContent(Symbol);
+    if (SymbolMem.size() < Offset + Size)
+      return false;
     ArrayRef<uint8_t> SymbolBytes(SymbolMem.bytes_begin() + Offset,
                                   SymbolMem.size() - Offset);
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D105528.360383.patch
Type: text/x-patch
Size: 634 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210721/4e72320f/attachment.bin>


More information about the llvm-commits mailing list