Author: Weverything
Date: 2022-05-03T16:07:58-07:00
New Revision: 3dd00461f9cb91a6582653500603882ed1475e51

URL: 
https://github.com/llvm/llvm-project/commit/3dd00461f9cb91a6582653500603882ed1475e51
DIFF: 
https://github.com/llvm/llvm-project/commit/3dd00461f9cb91a6582653500603882ed1475e51.diff

LOG: [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.

Added: 
    

Modified: 
    lldb/source/Plugins/Process/Linux/Procfs.cpp

Removed: 
    


################################################################################
diff  --git a/lldb/source/Plugins/Process/Linux/Procfs.cpp 
b/lldb/source/Plugins/Process/Linux/Procfs.cpp
index 1ff7c568d891f..756749e0a7e32 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<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();
 


        
_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to