Fix out-of-bounds array access in bucket fill

This commit is contained in:
Marcus Huderle 2021-02-12 17:23:45 -06:00
parent 36a6212af6
commit 3c2aa5d2e9

View file

@ -488,13 +488,12 @@ void MapPixmapItem::floodFill(
QPoint point = todo.takeAt(0); QPoint point = todo.takeAt(0);
int x = point.x(); int x = point.x();
int y = point.y(); int y = point.y();
visited[x + y * map->getWidth()] = true;
Block *block = map->getBlock(x, y); Block *block = map->getBlock(x, y);
if (!block) { if (!block) {
continue; continue;
} }
visited[x + y * map->getWidth()] = true;
int xDiff = x - initialX; int xDiff = x - initialX;
int yDiff = y - initialY; int yDiff = y - initialY;
int i = xDiff % selectionDimensions.x(); int i = xDiff % selectionDimensions.x();