mirror of
https://gitlab.kitware.com/cmake/cmake.git
synced 2026-10-12 23:43:59 +03: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:
1 parent
1d5c1b0023
commit
0fbc300bec
1 file changed
+5
-2
@@ -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