From 58c4fa2c538a73527aeeb4c7535016d9b9a1df18 Mon Sep 17 00:00:00 2001 From: Jonas Devlieghere Date: Thu, 30 Jan 2020 15:35:09 -0800 Subject: [PATCH] [lldb/Reproducers] Use LLDB_RECORD_DUMMY for GetStopDescription GetStopDescription writes to a const char* with a given length. However, the reproducer instrumentation serialized the char pointer and length separately. To serialize the string, we naively look for the first null byte to determine its length. This can lead to the method overwriting the input buffer when the assumed string length is smaller than the actual number of bytes written by GetStopDescription. The real solution is to have a custom serializer that takes both arguments into account. However, given that these are output parameters, they don't affect replay. If the string is passed as input later, it's is recorded as such. Therefore I've replaced the instrumentation macro with LLDB_RECORD_DUMMY which skips the serialization. --- lldb/source/API/SBThread.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lldb/source/API/SBThread.cpp b/lldb/source/API/SBThread.cpp index f90e93130960a..6fe4f66763cb2 100644 --- a/lldb/source/API/SBThread.cpp +++ b/lldb/source/API/SBThread.cpp @@ -313,7 +313,7 @@ SBThread::GetStopReasonExtendedBacktraces(InstrumentationRuntimeType type) { } size_t SBThread::GetStopDescription(char *dst, size_t dst_len) { - LLDB_RECORD_METHOD(size_t, SBThread, GetStopDescription, (char *, size_t), + LLDB_RECORD_DUMMY(size_t, SBThread, GetStopDescription, (char *, size_t), dst, dst_len); std::unique_lock lock;