summaryrefslogtreecommitdiffstats
path: root/lldb/source/Core/Module.cpp
diff options
context:
space:
mode:
authorFrederic Riss <friss@apple.com>2018-06-01 20:14:21 +0000
committerFrederic Riss <friss@apple.com>2018-06-01 20:14:21 +0000
commit9cd4def1c6affbfdec410c7e9bfa2fad15ccdaf8 (patch)
treec354b03e11a5fb2ba13f8661b9f93bc93bb0b3f4 /lldb/source/Core/Module.cpp
parent1943b49c99a3ea7df455788e9402a2501d618c05 (diff)
downloadbcm5719-llvm-9cd4def1c6affbfdec410c7e9bfa2fad15ccdaf8.tar.gz
bcm5719-llvm-9cd4def1c6affbfdec410c7e9bfa2fad15ccdaf8.zip
Fix Module::FindTypes to return the correct number of matches.
In r331719, I changed Module::FindTypes not to limit the amount of types returned by the Symbol provider, because we want all possible matches to be able to filter them. In one code path, the filtering was applied to the TypeList without changing the number of types that gets returned. This is turn could cause consumers to access beyond the end of the TypeList. This patch fixes this case and also adds an assertion to TypeList::GetTypeAtIndex to catch those obvious programming mistakes. Triggering the condition in which we performed the incorrect access was not easy. It happened a lot in mixed Swift/ObjectiveC code, but I was able to trigger it in pure Objective C++ although in a contrieved way. rdar://problem/40254997 llvm-svn: 333786
Diffstat (limited to 'lldb/source/Core/Module.cpp')
-rw-r--r--lldb/source/Core/Module.cpp1
1 files changed, 1 insertions, 0 deletions
diff --git a/lldb/source/Core/Module.cpp b/lldb/source/Core/Module.cpp
index e586a628321..6ffcd787ec8 100644
--- a/lldb/source/Core/Module.cpp
+++ b/lldb/source/Core/Module.cpp
@@ -1030,6 +1030,7 @@ size_t Module::FindTypes(
std::string name_str(name.AsCString(""));
typesmap.RemoveMismatchedTypes(type_scope, name_str, type_class,
exact_match);
+ num_matches = typesmap.GetSize();
}
}
}
OpenPOWER on IntegriCloud