Thanks Pavel!
On Thu, Oct 3, 2019 at 12:57 AM Pavel Labath via lldb-commits <lldb-commits@lists.llvm.org> wrote: > > Author: labath > Date: Thu Oct 3 00:59:26 2019 > New Revision: 373572 > > URL: http://llvm.org/viewvc/llvm-project?rev=373572&view=rev > Log: > Fix a use-after-free in GDBRemoteCommunicationServerLLGS > > Although it's called "GetString", StreamString::GetString actually > returns a StringRef. Creating a json object with a StringRef does not > make a copy, which means the StringRef will be dangling as soon as the > underlying stream is destroyed. Add a .str() to force the json object to > hold a copy of the string. > > This fixes nearly every test on linux. > > Modified: > > lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp > > Modified: > lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp > URL: > http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp?rev=373572&r1=373571&r2=373572&view=diff > ============================================================================== > --- > lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp > (original) > +++ > lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp > Thu Oct 3 00:59:26 2019 > @@ -462,7 +462,8 @@ GetRegistersAsJSON(NativeThreadProtocol > WriteRegisterValueInHexFixedWidth(stream, reg_ctx, *reg_info_p, > ®_value, lldb::eByteOrderBig); > > - register_object.try_emplace(llvm::to_string(reg_num), > stream.GetString()); > + register_object.try_emplace(llvm::to_string(reg_num), > + stream.GetString().str()); > } > > return register_object; > > > _______________________________________________ > lldb-commits mailing list > lldb-commits@lists.llvm.org > https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits _______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits