[Lldb-commits] [lldb] r333585 - [lldb-test] ir-memory-map: Avoid accessing a bad iterator
Vedant Kumar via lldb-commits
lldb-commits at lists.llvm.org
Wed May 30 12:46:47 PDT 2018
Author: vedantk
Date: Wed May 30 12:46:47 2018
New Revision: 333585
URL: http://llvm.org/viewvc/llvm-project?rev=333585&view=rev
Log:
[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.
Modified:
lldb/trunk/tools/lldb-test/lldb-test.cpp
Modified: lldb/trunk/tools/lldb-test/lldb-test.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/lldb-test/lldb-test.cpp?rev=333585&r1=333584&r2=333585&view=diff
==============================================================================
--- lldb/trunk/tools/lldb-test/lldb-test.cpp (original)
+++ lldb/trunk/tools/lldb-test/lldb-test.cpp Wed May 30 12:46:47 2018
@@ -551,17 +551,15 @@ bool opts::irmemorymap::evalMalloc(IRMem
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.
More information about the lldb-commits
mailing list