[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.
This commit is contained in:
Jonas Devlieghere 2020-01-30 15:35:09 -08:00
parent 6a4acb9d80
commit 58c4fa2c53
1 changed files with 1 additions and 1 deletions

View File

@ -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<std::recursive_mutex> lock;