]> SALOME platform Git repositories - modules/smesh.git/commitdiff
Salome HOME
Fix for SIGSEGV on Mandriva2008 in optimize mode only
authoreap <eap@opencascade.com>
Thu, 19 Aug 2010 13:28:02 +0000 (13:28 +0000)
committereap <eap@opencascade.com>
Thu, 19 Aug 2010 13:28:02 +0000 (13:28 +0000)
==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.

src/StdMeshers/StdMeshers_Penta_3D.cxx

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