Fix #29965: Crash: Memory psys node array: end corrupt

Original indices from right operand were used in boolean result derived mesh
which lead to crash if right operand has got more entities (faces/edges/vertices)
than left operand.
This commit is contained in:
Sergey Sharybin
2012-01-24 08:43:17 +00:00
parent e634cb2607
commit 9998d1235b

View File

@@ -350,7 +350,7 @@ static DerivedMesh *ConvertCSGDescriptorsToDerivedMesh(
GHash *material_hash = NULL;
Mesh *me1= (Mesh*)ob1->data;
Mesh *me2= (Mesh*)ob2->data;
int i;
int i, *origindex_layer;
// create a new DerivedMesh
result = CDDM_new(vertex_it->num_elements, 0, face_it->num_elements);
@@ -379,6 +379,8 @@ static DerivedMesh *ConvertCSGDescriptorsToDerivedMesh(
*totmat = 0;
}
origindex_layer = result->getFaceDataArray(result, CD_ORIGINDEX);
// step through the face iterators
for(i = 0; !face_it->Done(face_it->it); i++) {
Mesh *orig_me;
@@ -427,6 +429,9 @@ static DerivedMesh *ConvertCSGDescriptorsToDerivedMesh(
(orig_me == me2)? mapmat: NULL);
test_index_face(mface, &result->faceData, i, csgface.vertex_number);
if(origindex_layer && orig_ob == ob2)
origindex_layer[i] = ORIGINDEX_NONE;
}
if (material_hash)