Merge pull request #73157 from akien-mga/surfacetool-commit-crash

Fix SurfaceTool crash with invalid bone/weight count
This commit is contained in:
Yuri Sizov 2023-02-12 22:40:42 +03:00 committed by GitHub
commit 72c5b56d04
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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;
}