diff options
| author | Pavel Labath <pavel@labath.sk> | 2018-12-27 13:45:55 +0000 |
|---|---|---|
| committer | Pavel Labath <pavel@labath.sk> | 2018-12-27 13:45:55 +0000 |
| commit | 9352f4706a7aaf3d25ff4158ba4f83fbc9e86425 (patch) | |
| tree | 3523eefd6fe5a02e6b840d85a9c46ac7092fe5c5 | |
| parent | 018f505c9eb1d94d5c8be9ecd0f440d614c17199 (diff) | |
| download | bcm5719-llvm-9352f4706a7aaf3d25ff4158ba4f83fbc9e86425.tar.gz bcm5719-llvm-9352f4706a7aaf3d25ff4158ba4f83fbc9e86425.zip | |
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.
llvm-svn: 350091
| -rw-r--r-- | lldb/unittests/Host/NativeProcessProtocolTest.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/lldb/unittests/Host/NativeProcessProtocolTest.cpp b/lldb/unittests/Host/NativeProcessProtocolTest.cpp index 39d636207a5..298c2909b61 100644 --- a/lldb/unittests/Host/NativeProcessProtocolTest.cpp +++ b/lldb/unittests/Host/NativeProcessProtocolTest.cpp @@ -131,7 +131,8 @@ llvm::Expected<std::vector<uint8_t>> FakeMemory::Read(addr_t Addr, 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, |

