From: Kevin Enderby Date: Mon, 24 Jul 2017 20:33:41 +0000 (+0000) Subject: Small tweak to one check in error handling to the dyld compact export X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=04cdb2eeb460026329bc765469ff557a3112fa19;p=llvm 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 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@308924 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Object/MachOObjectFile.cpp b/lib/Object/MachOObjectFile.cpp index 8b85049ea63..579faf607c0 100644 --- a/lib/Object/MachOObjectFile.cpp +++ b/lib/Object/MachOObjectFile.cpp @@ -2789,13 +2789,13 @@ void ExportEntry::pushNode(uint64_t offset) { 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();