Fix for SIGSEGV on Mandriva2008 in optimize mode only

==21300== Invalid read of size 4
==21300==    at 0x1445EA23: StdMeshers_Penta_3D::MakeVolumeMesh() (StdMeshers_Penta_3D.cxx:681)

  while (aItNodes->more()) {

It seems to be an error of optimization, aItNodes.px becomes invalid
before aItNodes->more() returns false but after the loop code is
performed for the last time.
This commit is contained in:
eap 2010-08-19 13:28:02 +00:00
parent 23a1a900c3
commit 0bce8612a5

View File

@ -676,22 +676,16 @@ void StdMeshers_Penta_3D::MakeVolumeMesh()
if ( aN.size() < nbFaceNodes * 2 ) if ( aN.size() < nbFaceNodes * 2 )
aN.resize( nbFaceNodes * 2 ); aN.resize( nbFaceNodes * 2 );
// //
k=0; for ( k=0; k<nbFaceNodes; ++k ) {
aItNodes=pE0->nodesIterator(); const SMDS_MeshNode* pNode = pE0->GetNode(k);
while (aItNodes->more()) { // if(myTool->IsMedium(pNode))
//const SMDS_MeshElement* pNode = aItNodes->next(); // continue;
const SMDS_MeshNode* pNode =
static_cast<const SMDS_MeshNode*> (aItNodes->next());
if(myTool->IsMedium(pNode))
continue;
aID0 = pNode->GetID(); aID0 = pNode->GetID();
aJ[k] = GetIndexOnLayer(aID0); aJ[k] = GetIndexOnLayer(aID0);
if (!myErrorStatus->IsOK()) { if (!myErrorStatus->IsOK()) {
MESSAGE("StdMeshers_Penta_3D::MakeVolumeMesh"); MESSAGE("StdMeshers_Penta_3D::MakeVolumeMesh");
return; return;
} }
//
++k;
} }
// //
bool forward = true; bool forward = true;