[Bf-blender-cvs] [032a35fb50b] temp_bmesh_multires: Fix memory corruption in sculpt neighbors code
Joseph Eagar
noreply at git.blender.org
Mon Apr 26 00:12:34 CEST 2021
Commit: 032a35fb50bf372f431a74db7c8f3e66ba62f98c
Author: Joseph Eagar
Date: Sun Apr 25 15:12:11 2021 -0700
Branches: temp_bmesh_multires
https://developer.blender.org/rB032a35fb50bf372f431a74db7c8f3e66ba62f98c
Fix memory corruption in sculpt neighbors code
===================================================================
M source/blender/editors/sculpt_paint/sculpt.c
===================================================================
diff --git a/source/blender/editors/sculpt_paint/sculpt.c b/source/blender/editors/sculpt_paint/sculpt.c
index 16c50cd15ec..4d1d384661d 100644
--- a/source/blender/editors/sculpt_paint/sculpt.c
+++ b/source/blender/editors/sculpt_paint/sculpt.c
@@ -1051,7 +1051,9 @@ static void sculpt_vertex_neighbor_add(SculptVertexNeighborIter *iter,
if (iter->neighbors == iter->neighbors_fixed) {
iter->neighbors = MEM_mallocN(iter->capacity * sizeof(SculptVertRef), "neighbor array");
iter->neighbor_indices = MEM_mallocN(iter->capacity * sizeof(int), "neighbor array");
- memcpy(iter->neighbors, iter->neighbors_fixed, sizeof(int) * iter->size);
+
+ memcpy(iter->neighbors, iter->neighbors_fixed, sizeof(SculptVertRef) * iter->size);
+ memcpy(iter->neighbor_indices, iter->neighbor_indices_fixed, sizeof(int) * iter->size);
}
else {
iter->neighbors = MEM_reallocN_id(
@@ -1534,6 +1536,7 @@ void SCULPT_floodfill_execute(SculptSession *ss,
SculptVertexNeighborIter ni;
SCULPT_VERTEX_DUPLICATES_AND_NEIGHBORS_ITER_BEGIN (ss, from_v, ni) {
const SculptVertRef to_v = ni.vertex;
+
const int to_index = BKE_pbvh_vertex_index_to_table(ss->pbvh, to_v);
if (BLI_BITMAP_TEST(flood->visited_vertices, to_index)) {
More information about the Bf-blender-cvs
mailing list