Add some safety checks to Platform::GetRemoteSharedModule so if it

is passed a ModuleSpec with a UUID, it won't accept a file it finds
with a matching FileSpec & ArchSpec, but with a different UUID.

<rdar://problem/27258864> 

llvm-svn: 275151
This commit is contained in:
Jason Molenda
2016-07-12 03:25:22 +00:00
parent ef5ec2da4a
commit 85967fa3c4

View File

@@ -1802,14 +1802,30 @@ Platform::GetRemoteSharedModule (const ModuleSpec &module_spec,
{
// Try to get module information from the process
if (process->GetModuleSpec (module_spec.GetFileSpec (), module_spec.GetArchitecture (), resolved_module_spec))
got_module_spec = true;
{
if (module_spec.GetUUID().IsValid() == false || module_spec.GetUUID() == resolved_module_spec.GetUUID())
{
got_module_spec = true;
}
}
}
if (!got_module_spec)
{
// Get module information from a target.
if (!GetModuleSpec (module_spec.GetFileSpec (), module_spec.GetArchitecture (), resolved_module_spec))
return module_resolver (module_spec);
{
if (module_spec.GetUUID().IsValid() == false || module_spec.GetUUID() == resolved_module_spec.GetUUID())
{
return module_resolver (module_spec);
}
}
}
// If we are looking for a specific UUID, make sure resolved_module_spec has the same one before we search.
if (module_spec.GetUUID().IsValid())
{
resolved_module_spec.GetUUID() = module_spec.GetUUID();
}
// Trying to find a module by UUID on local file system.