Skip to content

Commit

Permalink
Merge pull request #40327 from pkdawson/patch-1
Browse files Browse the repository at this point in the history
Avoid overflow when calculating visible_cells
  • Loading branch information
akien-mga authored Jul 14, 2020
2 parents c2ed367 + 9e28df2 commit 2921827
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion scene/resources/world_2d.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 2921827

Please sign in to comment.