forked from OSchip/llvm-project
[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
This commit is contained in:
parent
b6423479a1
commit
f3b6d2930d
|
@ -551,8 +551,7 @@ bool opts::irmemorymap::evalMalloc(IRMemoryMap &IRMemMap, StringRef Line,
|
||||||
auto Probe = AllocatedIntervals.begin();
|
auto Probe = AllocatedIntervals.begin();
|
||||||
Probe.advanceTo(Addr); //< First interval s.t stop >= Addr.
|
Probe.advanceTo(Addr); //< First interval s.t stop >= Addr.
|
||||||
AllocationT NewAllocation = {Addr, EndOfRegion};
|
AllocationT NewAllocation = {Addr, EndOfRegion};
|
||||||
if (Probe != AllocatedIntervals.end()) {
|
while (Probe != AllocatedIntervals.end() && Probe.start() < EndOfRegion) {
|
||||||
while (Probe.start() < EndOfRegion) {
|
|
||||||
AllocationT ProbeAllocation = {Probe.start(), Probe.stop()};
|
AllocationT ProbeAllocation = {Probe.start(), Probe.stop()};
|
||||||
if (areAllocationsOverlapping(ProbeAllocation, NewAllocation)) {
|
if (areAllocationsOverlapping(ProbeAllocation, NewAllocation)) {
|
||||||
outs() << "Malloc error: overlapping allocation detected"
|
outs() << "Malloc error: overlapping allocation detected"
|
||||||
|
@ -562,7 +561,6 @@ bool opts::irmemorymap::evalMalloc(IRMemoryMap &IRMemMap, StringRef Line,
|
||||||
}
|
}
|
||||||
++Probe;
|
++Probe;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// Insert the new allocation into the interval map.
|
// Insert the new allocation into the interval map.
|
||||||
if (Size)
|
if (Size)
|
||||||
|
|
Loading…
Reference in New Issue