Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2020-02-11 04:35:10 +0300
committerCampbell Barton <ideasman42@gmail.com>2020-02-11 05:20:49 +0300
commitad2a8400e9a263acf924311ce1fb050b0e1eb415 (patch)
treeee692cb7d489915c5b1242f2652a807e048e4f0a /source/blender/collada
parent56a4ee3fdbc647d037a89128725e5988715c59ad (diff)
Fix T56108: Crash editing corrupted vertex groups
While the file in this report had corrupted values, this is avoidable without adding any extra overhead. Use unsigned vertex group indices since we don't need negative values, this is an alternative to checking they aren't negative in many places. Vertex group values over INT_MAX is still considered invalid, so any accidental unsigned wrapping won't be silently ignored.
Diffstat (limited to 'source/blender/collada')
-rw-r--r--source/blender/collada/ControllerExporter.cpp12
1 files changed, 5 insertions, 7 deletions
diff --git a/source/blender/collada/ControllerExporter.cpp b/source/blender/collada/ControllerExporter.cpp
index ef91fcfa62c..0119aba7dfd 100644
--- a/source/blender/collada/ControllerExporter.cpp
+++ b/source/blender/collada/ControllerExporter.cpp
@@ -230,19 +230,17 @@ void ControllerExporter::export_skin_controller(Object *ob, Object *ob_arm)
float sumw = 0.0f;
for (j = 0; j < vert->totweight; j++) {
- int idx = vert->dw[j].def_nr;
+ uint idx = vert->dw[j].def_nr;
if (idx >= joint_index_by_def_index.size()) {
/* XXX: Maybe better find out where and
* why the Out Of Bound indexes get created ? */
oob_counter += 1;
}
else {
- if (idx >= 0) {
- int joint_index = joint_index_by_def_index[idx];
- if (joint_index != -1 && vert->dw[j].weight > 0.0f) {
- jw[joint_index] += vert->dw[j].weight;
- sumw += vert->dw[j].weight;
- }
+ int joint_index = joint_index_by_def_index[idx];
+ if (joint_index != -1 && vert->dw[j].weight > 0.0f) {
+ jw[joint_index] += vert->dw[j].weight;
+ sumw += vert->dw[j].weight;
}
}
}