Fix invalid array index in armature_deform_verts().

Check that the def_nr is non-negative before using as index.

Fixes bug [#31700] Crash when opening .blend file on 64bit environment
This commit is contained in:
Nicholas Bishop
2012-06-11 11:00:58 +00:00
parent d214b14052
commit eba2f2320c

View File

@@ -986,7 +986,7 @@ void armature_deform_verts(Object *armOb, Object *target, DerivedMesh *dm, float
for (j = dvert->totweight; j != 0; j--, dw++) {
const int index = dw->def_nr;
if (index < defbase_tot && (pchan = defnrToPC[index])) {
if (index >= 0 && index < defbase_tot && (pchan = defnrToPC[index])) {
float weight = dw->weight;
Bone *bone = pchan->bone;
pdef_info = pdef_info_array + defnrToPCIndex[index];