summaryrefslogtreecommitdiff
path: root/lib/CodeGen/LiveInterval.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2004-12-04 01:22:09 +0000
committerChris Lattner <sabre@nondot.org>2004-12-04 01:22:09 +0000
commitead1b3f0bb70cd9c1ba7a853a79070cb47db9344 (patch)
tree441068dacf6fdf88153564a212e96dda9422cdf3 /lib/CodeGen/LiveInterval.cpp
parent43ee293abe6843ff5bcf1f0e15f314b3c2fbf8e0 (diff)
downloadllvm-ead1b3f0bb70cd9c1ba7a853a79070cb47db9344.tar.gz
llvm-ead1b3f0bb70cd9c1ba7a853a79070cb47db9344.tar.bz2
llvm-ead1b3f0bb70cd9c1ba7a853a79070cb47db9344.tar.xz
Prevent accessing past the end of the intervals vector, this fixes
Prolang-C/bison in the JIT git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18477 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/LiveInterval.cpp')
-rw-r--r--lib/CodeGen/LiveInterval.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/CodeGen/LiveInterval.cpp b/lib/CodeGen/LiveInterval.cpp
index 54e460f7b4..a8bc1615b4 100644
--- a/lib/CodeGen/LiveInterval.cpp
+++ b/lib/CodeGen/LiveInterval.cpp
@@ -74,7 +74,9 @@ bool LiveInterval::overlapsFrom(const LiveInterval& other,
i = std::upper_bound(i, ie, j->start);
if (i != ranges.begin()) --i;
} else if (j->start < i->start) {
- if ((++StartPos)->start <= i->start) {
+ ++StartPos;
+ if (StartPos != other.end() && StartPos->start <= i->start) {
+ assert(StartPos < other.end() && i < end());
j = std::upper_bound(j, je, i->start);
if (j != other.ranges.begin()) --j;
}