diff options
author | Rémi Verschelde <rverschelde@gmail.com> | 2020-07-14 14:16:29 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-07-14 14:16:29 +0200 |
commit | 2921827387b339fef98cb761f9571dd0f1dd1986 (patch) | |
tree | 803bd123609936bfe43a0f9692fd467edee289be | |
parent | c2ed367d4981506cae8f351a2a56db87b98d6d94 (diff) | |
parent | 9e28df22a0195340016f3ec7271a0bd738c0e928 (diff) |
Merge pull request #40327 from pkdawson/patch-1
Avoid overflow when calculating visible_cells
-rw-r--r-- | scene/resources/world_2d.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/scene/resources/world_2d.cpp b/scene/resources/world_2d.cpp index 1c753fdb91..d2bc2bea31 100644 --- a/scene/resources/world_2d.cpp +++ b/scene/resources/world_2d.cpp @@ -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 |