From 3dd00461f9cb91a6582653500603882ed1475e51 Mon Sep 17 00:00:00 2001 From: Weverything Date: Tue, 3 May 2022 14:55:34 -0700 Subject: [PATCH] [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. --- lldb/source/Plugins/Process/Linux/Procfs.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lldb/source/Plugins/Process/Linux/Procfs.cpp b/lldb/source/Plugins/Process/Linux/Procfs.cpp index 1ff7c56..756749e 100644 --- a/lldb/source/Plugins/Process/Linux/Procfs.cpp +++ b/lldb/source/Plugins/Process/Linux/Procfs.cpp @@ -60,8 +60,8 @@ lldb_private::process_linux::GetAvailableLogicalCoreIDs() { if (!cpuinfo) return cpuinfo.takeError(); - Expected> core_ids = GetAvailableLogicalCoreIDs( - StringRef(reinterpret_cast(cpuinfo->data()))); + Expected> core_ids = GetAvailableLogicalCoreIDs(StringRef( + reinterpret_cast(cpuinfo->data()), cpuinfo->size())); if (!core_ids) return core_ids.takeError(); -- 2.7.4