Author: labath Date: Thu Dec 27 05:45:55 2018 New Revision: 350091 URL: http://llvm.org/viewvc/llvm-project?rev=350091&view=rev Log: Fix assertion failure in NativeProcessProtocolTest
The assertion fired (with a debug visual studio STL) because we tried to dereference the end of a vector (although it was only to take its address again and form an end iterator). Rewrite this logic to avoid the questionable code. Modified: lldb/trunk/unittests/Host/NativeProcessProtocolTest.cpp Modified: lldb/trunk/unittests/Host/NativeProcessProtocolTest.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/unittests/Host/NativeProcessProtocolTest.cpp?rev=350091&r1=350090&r2=350091&view=diff ============================================================================== --- lldb/trunk/unittests/Host/NativeProcessProtocolTest.cpp (original) +++ lldb/trunk/unittests/Host/NativeProcessProtocolTest.cpp Thu Dec 27 05:45:55 2018 @@ -131,7 +131,8 @@ llvm::Expected<std::vector<uint8_t>> Fak return llvm::createStringError(llvm::inconvertibleErrorCode(), "Address out of range."); Size = std::min(Size, Data.size() - (size_t)Addr); - return std::vector<uint8_t>(&Data[Addr], &Data[Addr + Size]); + auto Begin = std::next(Data.begin(), Addr); + return std::vector<uint8_t>(Begin, std::next(Begin, Size)); } llvm::Expected<size_t> FakeMemory::Write(addr_t Addr, _______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits