Tomato Cycles: fix incorrect memory read when synchronizing mesh motion
authorSergey Sharybin <sergey.vfx@gmail.com>
Fri, 17 Aug 2012 12:58:31 +0000 (12:58 +0000)
committerSergey Sharybin <sergey.vfx@gmail.com>
Fri, 17 Aug 2012 12:58:31 +0000 (12:58 +0000)
intern/cycles/blender/blender_mesh.cpp

index 16e4ceded89bfa7d0f29be860d32352617388d38..9764f24a89356667baa47caf44f35c4f28d850b3 100644 (file)
@@ -317,11 +317,11 @@ void BlenderSync::sync_mesh_motion(BL::Object b_ob, Mesh *mesh, int motion)
                BL::Mesh::vertices_iterator v;
                AttributeStandard std = (motion == -1)? ATTR_STD_MOTION_PRE: ATTR_STD_MOTION_POST;
                Attribute *attr_M = mesh->attributes.add(std);
-               float3 *M = attr_M->data_float3();
+               float3 *M = attr_M->data_float3(), *cur_M;
                size_t i = 0;
 
-               for(b_mesh.vertices.begin(v); v != b_mesh.vertices.end() && i < size; ++v, M++, i++)
-                       *M = get_float3(v->co());
+               for(b_mesh.vertices.begin(v), cur_M = M; v != b_mesh.vertices.end() && i < size; ++v, cur_M++, i++)
+                       *cur_M = get_float3(v->co());
 
                /* if number of vertices changed, or if coordinates stayed the same, drop it */
                if(i != size || memcmp(M, &mesh->verts[0], sizeof(float3)*size) == 0)