[PATCH] D66598: [Clang][Bundler] Fix for a hang when unbundling fat binary
Sergey Dmitriev via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Aug 27 13:08:01 PDT 2019
sdmitriev added a comment.
Sure. The main unbundling loop looks as follows (see loop on line 745)
while (!Worklist.empty()) {
StringRef CurTriple = FH.get()->ReadBundleStart(Input);
if (CurTriple.empty())
break;
auto Output = Worklist.find(CurTriple);
if (Output == Worklist.end()) {
continue;
}
...
}
Here `Worklist` is a collection of bundles that need to be extracted, and `FH` is the object implementing `FileHandler` interface. `FileHandler::ReadBundleStart()` returns the name of the bundle `FH` currently points to. As you can see in the loop above if the name returned by that call is not in the set of bundles that need to be extracted, we just call `ReadBundleStart` next time assuming that `FileHandler` would advance to the next bundle on each `ReadBundleStart` call. That assumption is correct for all `FileHandler` implementations except `BinaryFileHandler` which does not advance to the next bundle when this method is called. As a result we are going into an infinite loop if we need to skip a bundle for the file handled by the `BinaryFileHandler` . This patch just fixes this problem in the `BinaryFileHandler` implementation.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D66598/new/
https://reviews.llvm.org/D66598
More information about the cfe-commits
mailing list