mirror of
https://github.com/Kitware/CMake.git
synced 2026-03-09 10:00:12 -05:00
cmComputeLinkInformation: Fix out-of-bounds read in error case
In commit aba1c9d172 (target_link_libraries: Add support for the
LINKER: prefix, 2024-10-06) we added a call to `ResolveLinkerWrapper`.
Update the call site to account for the possibility of an empty result
vector on error.
This commit is contained in:
@@ -1904,11 +1904,14 @@ void cmComputeLinkInformation::AddUserItem(LinkEntry const& entry,
|
||||
this->Items.emplace_back(item, ItemIsPath::No);
|
||||
return;
|
||||
}
|
||||
|
||||
if (cmHasPrefix(item.Value, LINKER)) {
|
||||
std::vector<BT<std::string>> linkerFlag{ 1, item };
|
||||
this->Target->ResolveLinkerWrapper(linkerFlag, this->GetLinkLanguage(),
|
||||
true);
|
||||
this->Items.emplace_back(linkerFlag.front(), ItemIsPath::No);
|
||||
/* joinItems = */ true);
|
||||
if (!linkerFlag.empty()) {
|
||||
this->Items.emplace_back(linkerFlag.front(), ItemIsPath::No);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user