diff options
author | Vedant Kumar <vsk@apple.com> | 2018-05-30 19:46:47 +0000 |
---|---|---|
committer | Vedant Kumar <vsk@apple.com> | 2018-05-30 19:46:47 +0000 |
commit | f3b6d2930d4aac4a217da5d6edb8413626b9e713 (patch) | |
tree | f1e24a0854f54217a995058884144a9cc0160a6d /lldb/tools | |
parent | b6423479a185d268baf5a2f88809a819d4892264 (diff) | |
download | bcm5719-llvm-f3b6d2930d4aac4a217da5d6edb8413626b9e713.tar.gz bcm5719-llvm-f3b6d2930d4aac4a217da5d6edb8413626b9e713.zip |
[lldb-test] ir-memory-map: Avoid accessing a bad iterator
Do not access Probe.start() when Probe is at the end of the interval
map.
llvm-svn: 333585
Diffstat (limited to 'lldb/tools')
-rw-r--r-- | lldb/tools/lldb-test/lldb-test.cpp | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/lldb/tools/lldb-test/lldb-test.cpp b/lldb/tools/lldb-test/lldb-test.cpp index 0bfc52a2011..7f9cd6ba841 100644 --- a/lldb/tools/lldb-test/lldb-test.cpp +++ b/lldb/tools/lldb-test/lldb-test.cpp @@ -551,17 +551,15 @@ bool opts::irmemorymap::evalMalloc(IRMemoryMap &IRMemMap, StringRef Line, auto Probe = AllocatedIntervals.begin(); Probe.advanceTo(Addr); //< First interval s.t stop >= Addr. AllocationT NewAllocation = {Addr, EndOfRegion}; - if (Probe != AllocatedIntervals.end()) { - while (Probe.start() < EndOfRegion) { - AllocationT ProbeAllocation = {Probe.start(), Probe.stop()}; - if (areAllocationsOverlapping(ProbeAllocation, NewAllocation)) { - outs() << "Malloc error: overlapping allocation detected" - << formatv(", previous allocation at [{0:x}, {1:x})\n", - Probe.start(), Probe.stop()); - exit(1); - } - ++Probe; + while (Probe != AllocatedIntervals.end() && Probe.start() < EndOfRegion) { + AllocationT ProbeAllocation = {Probe.start(), Probe.stop()}; + if (areAllocationsOverlapping(ProbeAllocation, NewAllocation)) { + outs() << "Malloc error: overlapping allocation detected" + << formatv(", previous allocation at [{0:x}, {1:x})\n", + Probe.start(), Probe.stop()); + exit(1); } + ++Probe; } // Insert the new allocation into the interval map. |