]> SALOME platform Git repositories - tools/medcoupling.git/commitdiff
Salome HOME
Protect MEDCouplingUMesh::IntersectMeshes against agressive users.
authorgeay <anthony.geay@cea.fr>
Fri, 28 Mar 2014 09:58:07 +0000 (10:58 +0100)
committergeay <anthony.geay@cea.fr>
Fri, 28 Mar 2014 09:58:07 +0000 (10:58 +0100)
src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DQuadraticPolygon.cxx

index 9721d1fc9c0c831865715324c4570c504fd6f5c5..a1df7ca5ce84c0c769c30c0d021e9af99b39c813 100644 (file)
@@ -1120,6 +1120,7 @@ std::list<QuadraticPolygon *>::iterator QuadraticPolygon::fillAsMuchAsPossibleWi
   if(!direction)
     it.previousLoop();
   Node *nodeToTest;
+  int szMax(pol1Splitted.size()+1),ii(0);// here a protection against agressive users of IntersectMeshes of invalid input meshes
   std::list<QuadraticPolygon *>::iterator ret;
   do
     {
@@ -1133,8 +1134,11 @@ std::list<QuadraticPolygon *>::iterator QuadraticPolygon::fillAsMuchAsPossibleWi
       ret=CheckInList(nodeToTest,iStart,iEnd);
       if(completed())
         return iEnd;
+      ii++;
     }
-  while(ret==iEnd);
+  while(ret==iEnd && ii<szMax);
+  if(ii==szMax)// here a protection against agressive users of IntersectMeshes of invalid input meshes
+    throw INTERP_KERNEL::Exception("QuadraticPolygon::fillAsMuchAsPossibleWith : Something is invalid with input polygons !");
   return ret;
 }