[trace][intelpt] Fix out-of-bounds access.

The StringRef single argument constructor expects a null-terminated
string.  Explicitly pass the size to prevent reading pass the end
of the array.
This commit is contained in:
Weverything 2022-05-03 14:55:34 -07:00
parent c4e5a24dd6
commit 3dd00461f9
1 changed files with 2 additions and 2 deletions

View File

@ -60,8 +60,8 @@ lldb_private::process_linux::GetAvailableLogicalCoreIDs() {
if (!cpuinfo)
return cpuinfo.takeError();
Expected<std::vector<int>> core_ids = GetAvailableLogicalCoreIDs(
StringRef(reinterpret_cast<const char *>(cpuinfo->data())));
Expected<std::vector<int>> core_ids = GetAvailableLogicalCoreIDs(StringRef(
reinterpret_cast<const char *>(cpuinfo->data()), cpuinfo->size()));
if (!core_ids)
return core_ids.takeError();