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@gmail.com>2018-01-15 00:14:20 +0300
committerBrecht Van Lommel <brechtvanlommel@gmail.com>2018-01-18 02:54:07 +0300
commite04d7c49dca9dc7bbf1cbe446b612aaa5ba12581 (patch)
treef9248150341b73cd72978f9075a453fe021c2995 /source/blender/modifiers/intern/MOD_skin.c
parente0f2c7aff484c7448903a1466829675494ebae6c (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_skin.c')
-rw-r--r--source/blender/modifiers/intern/MOD_skin.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/source/blender/modifiers/intern/MOD_skin.c b/source/blender/modifiers/intern/MOD_skin.c
index ad1e4badd3e..6006b486280 100644
--- a/source/blender/modifiers/intern/MOD_skin.c
+++ b/source/blender/modifiers/intern/MOD_skin.c
@@ -419,7 +419,7 @@ static Frame **collect_hull_frames(int v, SkinNode *frames,
int nbr, i;
(*tothullframe) = emap[v].count;
- hull_frames = MEM_callocN(sizeof(Frame *) * (*tothullframe),
+ hull_frames = MEM_calloc_arrayN((*tothullframe), sizeof(Frame *),
"hull_from_frames.hull_frames");
i = 0;
for (nbr = 0; nbr < emap[v].count; nbr++) {
@@ -600,7 +600,7 @@ static SkinNode *build_frames(const MVert *mvert, int totvert,
SkinNode *skin_nodes;
int v;
- skin_nodes = MEM_callocN(sizeof(SkinNode) * totvert, "build_frames.skin_nodes");
+ skin_nodes = MEM_calloc_arrayN(totvert, sizeof(SkinNode), "build_frames.skin_nodes");
for (v = 0; v < totvert; v++) {
if (emap[v].count <= 1)
@@ -722,7 +722,7 @@ static EMat *build_edge_mats(const MVertSkin *vs,
stack = BLI_stack_new(sizeof(stack_elem), "build_edge_mats.stack");
visited_e = BLI_BITMAP_NEW(totedge, "build_edge_mats.visited_e");
- emat = MEM_callocN(sizeof(EMat) * totedge, "build_edge_mats.emat");
+ emat = MEM_calloc_arrayN(totedge, sizeof(EMat), "build_edge_mats.emat");
/* Edge matrices are built from the root nodes, add all roots with
* children to the stack */
@@ -836,14 +836,14 @@ static DerivedMesh *subdivide_base(DerivedMesh *orig)
totorigedge = orig->getNumEdges(orig);
/* Get degree of all vertices */
- degree = MEM_callocN(sizeof(int) * totorigvert, "degree");
+ degree = MEM_calloc_arrayN(totorigvert, sizeof(int), "degree");
for (i = 0; i < totorigedge; i++) {
degree[origedge[i].v1]++;
degree[origedge[i].v2]++;
}
/* Per edge, store how many subdivisions are needed */
- edge_subd = MEM_callocN(sizeof(int) * totorigedge, "edge_subd");
+ edge_subd = MEM_calloc_arrayN(totorigedge, sizeof(int), "edge_subd");
for (i = 0, totsubd = 0; i < totorigedge; i++) {
edge_subd[i] += calc_edge_subdivisions(origvert, orignode,
&origedge[i], degree);
@@ -882,7 +882,7 @@ static DerivedMesh *subdivide_base(DerivedMesh *orig)
if (origdvert) {
const MDeformVert *dv1 = &origdvert[e->v1];
const MDeformVert *dv2 = &origdvert[e->v2];
- vgroups = MEM_callocN(sizeof(*vgroups) * dv1->totweight, "vgroup");
+ vgroups = MEM_calloc_arrayN(dv1->totweight, sizeof(*vgroups), "vgroup");
/* Only want vertex groups used by both vertices */
for (j = 0; j < dv1->totweight; j++) {