Merge pull request #40327 from pkdawson/patch-1

Avoid overflow when calculating visible_cells
This commit is contained in:
Rémi Verschelde 2020-07-14 14:16:29 +02:00 committed by GitHub
commit 2921827387
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -211,7 +211,7 @@ struct SpatialIndexer2D {
List<VisibilityNotifier2D *> added;
List<VisibilityNotifier2D *> removed;
int visible_cells = (end.x - begin.x) * (end.y - begin.y);
uint64_t visible_cells = (uint64_t)(end.x - begin.x) * (uint64_t)(end.y - begin.y);
if (visible_cells > 10000) {
//well you zoomed out a lot, it's your problem. To avoid freezing in the for loops below, we'll manually check cell by cell