[llvm] r308924 - Small tweak to one check in error handling to the dyld compact export

Kevin Enderby via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 24 13:33:41 PDT 2017


Author: enderby
Date: Mon Jul 24 13:33:41 2017
New Revision: 308924

URL: http://llvm.org/viewvc/llvm-project?rev=308924&view=rev
Log:
Small tweak to one check in error handling to the dyld compact export
entries in libObject (done in r308690).  In the case when the last node
has no children setting State.Current = Children + 1; where that would be past
Trie.end() is actually ok since the pointer is not used with zero children.

rdar://33490512

Modified:
    llvm/trunk/lib/Object/MachOObjectFile.cpp

Modified: llvm/trunk/lib/Object/MachOObjectFile.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Object/MachOObjectFile.cpp?rev=308924&r1=308923&r2=308924&view=diff
==============================================================================
--- llvm/trunk/lib/Object/MachOObjectFile.cpp (original)
+++ llvm/trunk/lib/Object/MachOObjectFile.cpp Mon Jul 24 13:33:41 2017
@@ -2789,13 +2789,13 @@ void ExportEntry::pushNode(uint64_t offs
       return;
     }
   }
-  if (Children + 1 >= Trie.end()) {
+  State.ChildCount = *Children;
+  if (State.ChildCount != 0 && Children + 1 >= Trie.end()) {
     *E = malformedError("byte for count of childern in export trie data at "
            "node: 0x" + utohexstr(offset) + " extends past end of trie data");
     moveToEnd();
     return;
   }
-  State.ChildCount = *Children;
   State.Current = Children + 1;
   State.NextChildIndex = 0;
   State.ParentStringLength = CumulativeString.size();




More information about the llvm-commits mailing list