From 56aa9f71b6cbf7b28ec739a8fa2042b8b36bc6cd Mon Sep 17 00:00:00 2001 From: LATRio Date: Sun, 3 Oct 2021 16:36:01 +0900 Subject: [PATCH] Prevent out of bound access through 'm_nodes' in SoftBodyBullet --- modules/bullet/soft_body_bullet.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/modules/bullet/soft_body_bullet.cpp b/modules/bullet/soft_body_bullet.cpp index cf7af595047..ce6566a8de0 100644 --- a/modules/bullet/soft_body_bullet.cpp +++ b/modules/bullet/soft_body_bullet.cpp @@ -169,6 +169,7 @@ void SoftBodyBullet::set_node_position(int p_node_index, const Vector3 &p_global void SoftBodyBullet::set_node_position(int p_node_index, const btVector3 &p_global_position) { if (bt_soft_body) { + ERR_FAIL_INDEX(p_node_index, bt_soft_body->m_nodes.size()); bt_soft_body->m_nodes[p_node_index].m_q = bt_soft_body->m_nodes[p_node_index].m_x; bt_soft_body->m_nodes[p_node_index].m_x = p_global_position; } @@ -176,6 +177,7 @@ void SoftBodyBullet::set_node_position(int p_node_index, const btVector3 &p_glob void SoftBodyBullet::get_node_position(int p_node_index, Vector3 &r_position) const { if (bt_soft_body) { + ERR_FAIL_INDEX(p_node_index, bt_soft_body->m_nodes.size()); B_TO_G(bt_soft_body->m_nodes[p_node_index].m_x, r_position); } }