From 4641e6b1705e749b22bf66f57d625287dce5c013 Mon Sep 17 00:00:00 2001 From: Haoyu Qiu Date: Tue, 27 Jul 2021 12:26:13 +0800 Subject: [PATCH] Add check to internal methods to prevent crash (cherry picked from commit 448295cd5183dc8cc168651aa69f5569538dce54) --- scene/2d/tile_map.cpp | 1 + scene/3d/proximity_group.cpp | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/scene/2d/tile_map.cpp b/scene/2d/tile_map.cpp index 142e4e84d39..a051443c7a3 100644 --- a/scene/2d/tile_map.cpp +++ b/scene/2d/tile_map.cpp @@ -1217,6 +1217,7 @@ void TileMap::_set_tile_data(const PoolVector &p_data) { PoolVector::Read r = p_data.read(); int offset = (format == FORMAT_2) ? 3 : 2; + ERR_FAIL_COND_MSG(c % offset != 0, "Corrupted tile data."); clear(); for (int i = 0; i < c; i += offset) { diff --git a/scene/3d/proximity_group.cpp b/scene/3d/proximity_group.cpp index 40aaa9dd7ab..82cafe6e022 100644 --- a/scene/3d/proximity_group.cpp +++ b/scene/3d/proximity_group.cpp @@ -140,7 +140,7 @@ void ProximityGroup::broadcast(String p_method, Variant p_parameters) { void ProximityGroup::_proximity_group_broadcast(String p_method, Variant p_parameters) { if (dispatch_mode == MODE_PROXY) { - + ERR_FAIL_COND(!is_inside_tree()); get_parent()->call(p_method, p_parameters); } else {