summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYuri Sizov <11782833+YuriSizov@users.noreply.github.com>2023-02-12 22:40:42 +0300
committerGitHub <noreply@github.com>2023-02-12 22:40:42 +0300
commit72c5b56d04f18c7ab078cb543d9dc68d05958d11 (patch)
tree6bbd445c5719e3fac9a5ee8ab89d1e056dbefe3c
parent27af0f1413f1a7eff3645dafc19e6e13c9a48dd1 (diff)
parent77b415ab6d59e823a67668121853aee2b708fd2a (diff)
Merge pull request #73157 from akien-mga/surfacetool-commit-crash
Fix SurfaceTool crash with invalid bone/weight count
-rw-r--r--scene/resources/surface_tool.cpp4
1 files 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;
}