Mesh: Fix several coverity issues:
* CID 350557: Out-of-bounds read (false-positive) * CID 316517: Uninitialized scalar variable * CID 316519: Uninitialized scalar variable * CID 316547: Uninitialized scalar variable * CID 316556: Uninitialized scalar variable * CID 350614: Uncaught exception * CID 350606: Uncaught exception * CID 332681: Using invalid iterator
This commit is contained in:
@@ -763,7 +763,7 @@ bool MeshAlgorithm::FillupHole(const std::vector<PointIndex>& boundary,
|
||||
// Now we have two adjacent triangles which we check for overlaps.
|
||||
// Therefore we build a separation plane that must separate the two diametrically opposed points.
|
||||
Base::Vector3f planeNormal = rTriangle.GetNormal() % (rTriangle._aclPoints[(ref_side+1)%3]-rTriangle._aclPoints[ref_side]);
|
||||
Base::Vector3f planeBase = rTriangle._aclPoints[ref_side];
|
||||
Base::Vector3f planeBase = rTriangle._aclPoints[ref_side%3];
|
||||
Base::Vector3f ref_point = rTriangle._aclPoints[(ref_side+2)%3];
|
||||
Base::Vector3f tri_point = triangle._aclPoints[(tri_side+2)%3];
|
||||
|
||||
|
||||
@@ -53,6 +53,8 @@ void MeshSimplify::simplify(float tolerance, float reduction)
|
||||
for (std::size_t i = 0; i < points.size(); i++) {
|
||||
Simplify::Vertex v;
|
||||
v.tstart = 0;
|
||||
v.tcount = 0;
|
||||
v.border = 0;
|
||||
v.p = points[i];
|
||||
alg.vertices.push_back(v);
|
||||
}
|
||||
@@ -60,6 +62,8 @@ void MeshSimplify::simplify(float tolerance, float reduction)
|
||||
const MeshFacetArray& facets = myKernel.GetFacets();
|
||||
for (std::size_t i = 0; i < facets.size(); i++) {
|
||||
Simplify::Triangle t;
|
||||
t.deleted = 0;
|
||||
t.dirty = 0;
|
||||
for (int j = 0; j < 4; j++)
|
||||
t.err[j] = 0.0;
|
||||
for (int j = 0; j < 3; j++)
|
||||
@@ -107,6 +111,8 @@ void MeshSimplify::simplify(int targetSize)
|
||||
for (std::size_t i = 0; i < points.size(); i++) {
|
||||
Simplify::Vertex v;
|
||||
v.tstart = 0;
|
||||
v.tcount = 0;
|
||||
v.border = 0;
|
||||
v.p = points[i];
|
||||
alg.vertices.push_back(v);
|
||||
}
|
||||
@@ -114,6 +120,8 @@ void MeshSimplify::simplify(int targetSize)
|
||||
const MeshFacetArray& facets = myKernel.GetFacets();
|
||||
for (std::size_t i = 0; i < facets.size(); i++) {
|
||||
Simplify::Triangle t;
|
||||
t.deleted = 0;
|
||||
t.dirty = 0;
|
||||
for (int j = 0; j < 4; j++)
|
||||
t.err[j] = 0.0;
|
||||
for (int j = 0; j < 3; j++)
|
||||
|
||||
@@ -111,7 +111,8 @@ int Exporter::addObject(App::DocumentObject *obj, float tol)
|
||||
it = meshCache.emplace(linked,
|
||||
static_cast<Mesh::Feature*>(linked)->Mesh.getValue()).first;
|
||||
it->second.setTransform(Base::Matrix4D());
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
Base::PyGILStateLocker lock;
|
||||
PyObject *pyobj = nullptr;
|
||||
linked->getSubObject("", &pyobj, nullptr, false);
|
||||
@@ -128,10 +129,14 @@ int Exporter::addObject(App::DocumentObject *obj, float tol)
|
||||
Py_DECREF(pyobj);
|
||||
}
|
||||
}
|
||||
MeshObject mesh(it->second);
|
||||
mesh.transformGeometry(matrix);
|
||||
if (addMesh(sobj->Label.getValue(), mesh))
|
||||
++count;
|
||||
|
||||
// Add a new mesh
|
||||
if (it != meshCache.end()) {
|
||||
MeshObject mesh(it->second);
|
||||
mesh.transformGeometry(matrix);
|
||||
if (addMesh(sobj->Label.getValue(), mesh))
|
||||
++count;
|
||||
}
|
||||
}
|
||||
return count;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user