From 0c3b75095af43d5c5a55fd37a35bf2398956fc66 Mon Sep 17 00:00:00 2001 From: eap Date: Wed, 19 Jun 2013 14:28:05 +0000 Subject: [PATCH] 0022232: [CEA 837] Memory corruption in GEOM/SMESH that leads to segfault on debian64 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 | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/GEOMAlgo/GEOMAlgo_Builder_3.cxx b/src/GEOMAlgo/GEOMAlgo_Builder_3.cxx index 024fa6681..73baab3bb 100755 --- a/src/GEOMAlgo/GEOMAlgo_Builder_3.cxx +++ b/src/GEOMAlgo/GEOMAlgo_Builder_3.cxx @@ -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);