From 77b415ab6d59e823a67668121853aee2b708fd2a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Verschelde?= Date: Sun, 12 Feb 2023 14:14:03 +0100 Subject: Fix SurfaceTool crash with invalid bone/weight count Fixes #53191. --- scene/resources/surface_tool.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scene/resources/surface_tool.cpp b/scene/resources/surface_tool.cpp index 16cc1c3370..ccb3ddee45 100644 --- a/scene/resources/surface_tool.cpp +++ b/scene/resources/surface_tool.cpp @@ -648,7 +648,7 @@ Array SurfaceTool::commit_to_arrays() { for (uint32_t idx = 0; idx < vertex_array.size(); idx++) { const Vertex &v = vertex_array[idx]; - if (v.bones.size() > count) { + if (v.bones.size() != count) { ERR_PRINT_ONCE(vformat("Invalid bones size %d vs count %d", v.bones.size(), count)); continue; } @@ -672,7 +672,7 @@ Array SurfaceTool::commit_to_arrays() { for (uint32_t idx = 0; idx < vertex_array.size(); idx++) { const Vertex &v = vertex_array[idx]; - if (v.weights.size() > count) { + if (v.weights.size() != count) { ERR_PRINT_ONCE(vformat("Invalid weight size %d vs count %d", v.weights.size(), count)); continue; } -- cgit v1.2.3