[Bf-blender-cvs] [1b2b7cf] master: Cycles: Fix overflow caused by wrong size calculation in Mesh::add_undisplaced
Mai Lavelle
noreply at git.blender.org
Thu Sep 22 23:51:31 CEST 2016
Commit: 1b2b7cfa2007172e07d78324bb941d0160b59c42
Author: Mai Lavelle
Date: Thu Sep 22 17:34:14 2016 -0400
Branches: master
https://developer.blender.org/rB1b2b7cfa2007172e07d78324bb941d0160b59c42
Cycles: Fix overflow caused by wrong size calculation in Mesh::add_undisplaced
===================================================================
M intern/cycles/render/mesh.cpp
===================================================================
diff --git a/intern/cycles/render/mesh.cpp b/intern/cycles/render/mesh.cpp
index 2d297c3..3eff35b 100644
--- a/intern/cycles/render/mesh.cpp
+++ b/intern/cycles/render/mesh.cpp
@@ -601,6 +601,12 @@ void Mesh::add_undisplaced()
/* copy verts */
size_t size = attr->buffer_size(this, (subdivision_type == SUBDIVISION_NONE) ? ATTR_PRIM_TRIANGLE : ATTR_PRIM_SUBD);
+
+ /* Center points for ngons aren't stored in Mesh::verts but are included in size since they will be
+ * calculated later, we subtract them from size here so we don't have an overflow while copying.
+ */
+ size -= num_ngons * attr->data_sizeof();
+
if(size) {
memcpy(data, verts.data(), size);
}
More information about the Bf-blender-cvs
mailing list