BucketBox: fixed possibility of writing one past the end of the given array

This commit is contained in:
Chris Frey
2020-11-15 17:48:10 -05:00
committed by Stuart Buchanan
parent 5d5f1779c6
commit 6ae7eb31a6

View File

@@ -286,16 +286,16 @@ public:
continue;
if (heightSplitBox.getWidthIsBucketSize()) {
assert(numTiles < bucketBoxListSize);
bucketBoxList[numTiles++] = heightSplitBox;
assert(numTiles <= bucketBoxListSize);
} else {
for (unsigned i = 0; i < _lonFactors[widthLevel]; ++i) {
BucketBox childBox = _intersection(heightSplitBox, heightSplitBox.getSubBoxWidth(i, widthLevel + 1));
if (childBox.empty())
continue;
assert(numTiles < bucketBoxListSize);
bucketBoxList[numTiles++] = childBox;
assert(numTiles <= bucketBoxListSize);
}
}
}