[PATCH] D47544: [MachO] Add out-of-bounds check to MachOObjectFile.cpp

Sam Clegg via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed May 30 10:11:55 PDT 2018


sbc100 created this revision.
Herald added subscribers: llvm-commits, aheejin.

This is a followup to https://reviews.llvm.org/rL333496.


Repository:
  rL LLVM

https://reviews.llvm.org/D47544

Files:
  lib/Object/MachOObjectFile.cpp


Index: lib/Object/MachOObjectFile.cpp
===================================================================
--- lib/Object/MachOObjectFile.cpp
+++ lib/Object/MachOObjectFile.cpp
@@ -107,6 +107,7 @@
 }
 
 static const char *getPtr(const MachOObjectFile &O, size_t Offset) {
+  assert(Offset <= O.getData().size());
   return O.getData().data() + Offset;
 }
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D47544.149152.patch
Type: text/x-patch
Size: 356 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180530/e2ca38ac/attachment.bin>


More information about the llvm-commits mailing list