diff options
author | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2018-01-15 00:14:20 +0300 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2018-01-18 02:54:07 +0300 |
commit | e04d7c49dca9dc7bbf1cbe446b612aaa5ba12581 (patch) | |
tree | f9248150341b73cd72978f9075a453fe021c2995 /source/blender/modifiers/intern/MOD_screw.c | |
parent | e0f2c7aff484c7448903a1466829675494ebae6c (diff) |
Fix buffer overflow vulnerabilities in mesh code.
Solves these security issues from T52924:
CVE-2017-12081
CVE-2017-12082
CVE-2017-12086
CVE-2017-12099
CVE-2017-12100
CVE-2017-12101
CVE-2017-12105
While the specific overflow issue may be fixed, loading the repro .blend
files may still crash because they are incomplete and corrupt. The way
they crash may be impossible to exploit, but this is difficult to prove.
Differential Revision: https://developer.blender.org/D3002
Diffstat (limited to 'source/blender/modifiers/intern/MOD_screw.c')
-rw-r--r-- | source/blender/modifiers/intern/MOD_screw.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/source/blender/modifiers/intern/MOD_screw.c b/source/blender/modifiers/intern/MOD_screw.c index 2c3d7f394bb..7896ea0a948 100644 --- a/source/blender/modifiers/intern/MOD_screw.c +++ b/source/blender/modifiers/intern/MOD_screw.c @@ -140,7 +140,7 @@ static DerivedMesh *dm_remove_doubles_on_axis( if (tot_doubles != 0) { uint tot = totvert * step_tot; - int *full_doubles_map = MEM_mallocN(sizeof(int) * tot, __func__); + int *full_doubles_map = MEM_malloc_arrayN(tot, sizeof(int), __func__); copy_vn_i(full_doubles_map, (int)tot, -1); uint tot_doubles_left = tot_doubles; @@ -449,10 +449,10 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, mpoly_orig = dm->getPolyArray(dm); mloop_orig = dm->getLoopArray(dm); - edge_poly_map = MEM_mallocN(sizeof(*edge_poly_map) * totedge, __func__); + edge_poly_map = MEM_malloc_arrayN(totedge, sizeof(*edge_poly_map), __func__); memset(edge_poly_map, 0xff, sizeof(*edge_poly_map) * totedge); - vert_loop_map = MEM_mallocN(sizeof(*vert_loop_map) * totvert, __func__); + vert_loop_map = MEM_malloc_arrayN(totvert, sizeof(*vert_loop_map), __func__); memset(vert_loop_map, 0xff, sizeof(*vert_loop_map) * totvert); for (i = 0, mp_orig = mpoly_orig; i < totpoly; i++, mp_orig++) { @@ -498,7 +498,7 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, * This makes the modifier faster with one less alloc. */ - vert_connect = MEM_mallocN(sizeof(ScrewVertConnect) * totvert, "ScrewVertConnect"); + vert_connect = MEM_malloc_arrayN(totvert, sizeof(ScrewVertConnect), "ScrewVertConnect"); //vert_connect = (ScrewVertConnect *) &medge_new[totvert]; /* skip the first slice of verts */ vc = vert_connect; |