[Lldb-commits] [lldb] 42c906b - [lldb/API] Fix non null-terminated stop-reason in SBThread::GetStopDescription

Med Ismail Bennani via lldb-commits lldb-commits at lists.llvm.org
Wed Feb 5 15:20:50 PST 2020


Author: Med Ismail Bennani
Date: 2020-02-06T00:20:33+01:00
New Revision: 42c906bceffaadeb704f2629d21f33aece831bc6

URL: https://github.com/llvm/llvm-project/commit/42c906bceffaadeb704f2629d21f33aece831bc6
DIFF: https://github.com/llvm/llvm-project/commit/42c906bceffaadeb704f2629d21f33aece831bc6.diff

LOG: [lldb/API] Fix non null-terminated stop-reason in SBThread::GetStopDescription

When trying to get the stop reason description using the SB API, the
buffer fetched was not null-terminated causing failures on the sanitized bot.

This patch should address those failures.

Signed-off-by: Med Ismail Bennani <medismail.bennani at gmail.com>

Added: 
    

Modified: 
    lldb/source/API/SBThread.cpp

Removed: 
    


################################################################################
diff  --git a/lldb/source/API/SBThread.cpp b/lldb/source/API/SBThread.cpp
index b215cddb4ca8..049a0b285e16 100644
--- a/lldb/source/API/SBThread.cpp
+++ b/lldb/source/API/SBThread.cpp
@@ -326,7 +326,7 @@ size_t SBThread::GetStopDescription(char *dst, size_t dst_len) {
       StopInfoSP stop_info_sp = exe_ctx.GetThreadPtr()->GetStopInfo();
       if (stop_info_sp) {
         const char *stop_desc =
-            exe_ctx.GetThreadPtr()->GetStopDescription().data();
+            exe_ctx.GetThreadPtr()->GetStopDescription().c_str();
         if (stop_desc) {
           if (dst)
             return ::snprintf(dst, dst_len, "%s", stop_desc);


        


More information about the lldb-commits mailing list