Prevent use after free caused by accessing a member into a dense set.

The member gets invalidated as elements are added to the dense set. Directly
access the underlying pointer instead. Not sure how to create a test case for
this :-(. Maybe Richard can help.

llvm-svn: 229673
This commit is contained in:
Daniel Jasper 2015-02-18 14:13:46 +00:00
parent 6ca8992018
commit c0b7c80fe6
1 changed files with 2 additions and 1 deletions

View File

@ -6628,7 +6628,8 @@ ASTReader::FindExternalVisibleDeclsByName(const DeclContext *DC,
auto Merged = MergedLookups.find(DC);
if (Merged != MergedLookups.end()) {
for (unsigned I = 0; I != Merged->second.size(); ++I) {
LookUpInContexts(Merged->second[I]);
const DeclContext *Context = Merged->second[I];
LookUpInContexts(Context);
// We might have just added some more merged lookups. If so, our
// iterator is now invalid, so grab a fresh one before continuing.
Merged = MergedLookups.find(DC);