Skip to content

Commit

Permalink
[lldb/Reproducers] Use LLDB_RECORD_DUMMY for GetStopDescription
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
JDevlieghere committed Jan 30, 2020
1 parent 6a4acb9 commit 58c4fa2
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lldb/source/API/SBThread.cpp
Expand Up @@ -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;
Expand Down

0 comments on commit 58c4fa2

Please sign in to comment.