Fix out-of-bound array access in WQSummary::SetPrune() (#5493)

This commit is contained in:
Zhang Zhang 2020-04-07 15:02:31 -07:00 committed by GitHub
parent a1085396e2
commit 8bc595ea1e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -207,7 +207,7 @@ struct WQSummary {
// find first i such that d < (rmax[i+1] + rmin[i+1]) / 2 // find first i such that d < (rmax[i+1] + rmin[i+1]) / 2
while (i < src.size - 1 while (i < src.size - 1
&& dx2 >= src.data[i + 1].rmax + src.data[i + 1].rmin) ++i; && dx2 >= src.data[i + 1].rmax + src.data[i + 1].rmin) ++i;
CHECK(i != src.size - 1); if (i == src.size - 1) break;
if (dx2 < src.data[i].RMinNext() + src.data[i + 1].RMaxPrev()) { if (dx2 < src.data[i].RMinNext() + src.data[i + 1].RMaxPrev()) {
if (i != lastidx) { if (i != lastidx) {
data[size++] = src.data[i]; lastidx = i; data[size++] = src.data[i]; lastidx = i;