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/blenkernel/intern/deform.c
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/blenkernel/intern/deform.c')
-rw-r--r--source/blender/blenkernel/intern/deform.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/source/blender/blenkernel/intern/deform.c b/source/blender/blenkernel/intern/deform.c
index 79dcdd15bf7..41ff9594cff 100644
--- a/source/blender/blenkernel/intern/deform.c
+++ b/source/blender/blenkernel/intern/deform.c
@@ -255,10 +255,9 @@ void defvert_remap(MDeformVert *dvert, int *map, const int map_len)
unsigned int i;
for (i = dvert->totweight; i != 0; i--, dw++) {
if (dw->def_nr < map_len) {
- dw->def_nr = map[dw->def_nr];
+ BLI_assert(map[dw->def_nr] >= 0);
- /* just in case */
- BLI_assert(dw->def_nr >= 0);
+ dw->def_nr = map[dw->def_nr];
}
}
}
@@ -337,7 +336,7 @@ void defvert_normalize(MDeformVert *dvert)
void defvert_normalize_lock_single(MDeformVert *dvert,
const bool *vgroup_subset,
const int vgroup_tot,
- const int def_nr_lock)
+ const uint def_nr_lock)
{
if (dvert->totweight == 0) {
/* nothing */