Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrecht Van Lommel <brechtvanlommel@pandora.be>2013-08-09 00:35:19 +0400
committerBrecht Van Lommel <brechtvanlommel@pandora.be>2013-08-09 00:35:19 +0400
commitd5fae4409ae895755f6391e05c0775232bf12902 (patch)
treef4abd91ded815f4d03eb81518cfd43b56e2d0126 /source/blender/modifiers/intern/MOD_weightvg_util.c
parent9a047852439514dbdb23f2e8ce68333b0156d514 (diff)
Fix #36417: vertex weight mix modifier crash with texture mask and subsurf modifier
preceding it, was writing past end of array.
Diffstat (limited to 'source/blender/modifiers/intern/MOD_weightvg_util.c')
-rw-r--r--source/blender/modifiers/intern/MOD_weightvg_util.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/source/blender/modifiers/intern/MOD_weightvg_util.c b/source/blender/modifiers/intern/MOD_weightvg_util.c
index 8ad9e26f788..e2267addd53 100644
--- a/source/blender/modifiers/intern/MOD_weightvg_util.c
+++ b/source/blender/modifiers/intern/MOD_weightvg_util.c
@@ -135,6 +135,7 @@ void weightvg_do_mask(int num, const int *indices, float *org_w, const float *ne
/* See mapping note below... */
MappingInfoModifierData t_map;
float (*v_co)[3];
+ int numVerts = dm->getNumVerts(dm);
/* Use new generic get_texture_coords, but do not modify our DNA struct for it...
* XXX Why use a ModifierData stuff here ? Why not a simple, generic struct for parameters ?
@@ -145,9 +146,9 @@ void weightvg_do_mask(int num, const int *indices, float *org_w, const float *ne
t_map.map_object = tex_map_object;
BLI_strncpy(t_map.uvlayer_name, tex_uvlayer_name, sizeof(t_map.uvlayer_name));
t_map.texmapping = tex_mapping;
- v_co = MEM_mallocN(sizeof(*v_co) * num, "WeightVG Modifier, TEX mode, v_co");
+ v_co = MEM_mallocN(sizeof(*v_co) * numVerts, "WeightVG Modifier, TEX mode, v_co");
dm->getVertCos(dm, v_co);
- tex_co = MEM_callocN(sizeof(*tex_co) * num, "WeightVG Modifier, TEX mode, tex_co");
+ tex_co = MEM_callocN(sizeof(*tex_co) * numVerts, "WeightVG Modifier, TEX mode, tex_co");
get_texture_coords(&t_map, ob, dm, v_co, tex_co, num);
MEM_freeN(v_co);