]> SALOME platform Git repositories - modules/geom.git/commitdiff
Salome HOME
0022232: [CEA 837] Memory corruption in GEOM/SMESH that leads to segfault on debian64
authoreap <eap@opencascade.com>
Wed, 19 Jun 2013 14:28:05 +0000 (14:28 +0000)
committereap <eap@opencascade.com>
Wed, 19 Jun 2013 14:28:05 +0000 (14:28 +0000)
Fix
==7374== Invalid read of size 8
==7374==    at 0x6B1F53F: TCollection_BasicMapIterator::Next() (in libTKernel.so.0.0.0)
==7374==    by 0x3A120D3A: GEOMAlgo_Builder::FillInternalShapes() (GEOMAlgo_Builder_3.cxx:717)

- in FillInternalShapes() fix removal of map items while iteration through the map

src/GEOMAlgo/GEOMAlgo_Builder_3.cxx

index 024fa6681e73bfb71c08ac35e9856a366d0c959c..73baab3bb45e99eb436e5d9869d3ecc4e67920c6 100755 (executable)
@@ -714,8 +714,9 @@ void GEOMAlgo_Builder::BuildDraftSolid (const TopoDS_Shape& theSolid,
     TopoDS_Solid aSd=TopoDS::Solid(aIt.Value());
     //
     aItM.Initialize(aMSI);
-    for (; aItM.More(); aItM.Next()) {
+    for (; aItM.More(); /*aItM.Next()*/) {
       TopoDS_Shape aSI=aItM.Key();
+      aItM.Next(); // to safely call aMSI.Remove(aSI)
       aSI.Orientation(TopAbs_INTERNAL);
       //
       aState=GEOMAlgo_Tools3D::ComputeStateByOnePoint(aSI, aSd, 1.e-11, aCtx);