foamyQuadMesh: Prevent indexing beyond end of face-vertices array

This commit is contained in:
Will Bainbridge
2020-07-07 16:11:48 +01:00
parent e63f3c1e98
commit ccd45f53a6
2 changed files with 7 additions and 8 deletions

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2013-2019 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2013-2020 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -194,7 +194,6 @@ class CV2D
//- Temporary storage for a dual-cell
static const label maxNvert = 20;
mutable point2D vertices[maxNvert+1];
mutable vector2D edges[maxNvert+1];
// Private Member Functions

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2013-2018 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2013-2020 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -291,7 +291,7 @@ void Foam::CV2D::calcDual
dualFaces.setSize(number_of_vertices());
label dualFacei = 0;
labelList faceVerts(maxNvert);
DynamicList<label> faceVerts(maxNvert);
for
(
@ -304,7 +304,8 @@ void Foam::CV2D::calcDual
{
Face_circulator fcStart = incident_faces(vit);
Face_circulator fc = fcStart;
label verti = 0;
faceVerts.clear();
do
{
@ -319,14 +320,13 @@ void Foam::CV2D::calcDual
}
// Look up the index of the triangle
faceVerts[verti++] = fc->faceIndex();
faceVerts.append(fc->faceIndex());
}
} while (++fc != fcStart);
if (faceVerts.size() > 2)
{
dualFaces[dualFacei++] =
face(labelList::subList(faceVerts, verti));
dualFaces[dualFacei++] = face(faceVerts);
}
else
{