[PATCH] D35022: [MachO] Add missing byte-swaps when reading dyld_info

Tom Stellard via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jul 7 08:20:48 PDT 2017


This revision was automatically updated to reflect the committed changes.
Closed by commit rL307405: [MachO] Add missing byte-swaps when reading dyld_info (authored by tstellar).

Repository:
  rL LLVM

https://reviews.llvm.org/D35022

Files:
  lld/trunk/lib/ReaderWriter/MachO/MachONormalizedFileBinaryReader.cpp


Index: lld/trunk/lib/ReaderWriter/MachO/MachONormalizedFileBinaryReader.cpp
===================================================================
--- lld/trunk/lib/ReaderWriter/MachO/MachONormalizedFileBinaryReader.cpp
+++ lld/trunk/lib/ReaderWriter/MachO/MachONormalizedFileBinaryReader.cpp
@@ -508,9 +508,9 @@
   if (dyldInfo) {
     // If any exports, extract and add to normalized exportInfo vector.
     if (dyldInfo->export_size) {
-      const uint8_t *trieStart = reinterpret_cast<const uint8_t*>(start +
-                                                          dyldInfo->export_off);
-      ArrayRef<uint8_t> trie(trieStart, dyldInfo->export_size);
+      const uint8_t *trieStart = reinterpret_cast<const uint8_t *>(
+          start + read32(&dyldInfo->export_off, isBig));
+      ArrayRef<uint8_t> trie(trieStart, read32(&dyldInfo->export_size, isBig));
       for (const ExportEntry &trieExport : MachOObjectFile::exports(trie)) {
         Export normExport;
         normExport.name = trieExport.name().copy(f->ownedAllocations);


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D35022.105647.patch
Type: text/x-patch
Size: 1044 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170707/5f3ebf46/attachment.bin>


More information about the llvm-commits mailing list