mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-07-25 12:55:50 +03:00
0030993: Modeling Algorithms - heap-use-after-free reported by Clang address sanitizer in BRepFeat_MakeRevolutionForm::Perform()
Use of reference to object removed from the list after that removal is avoided
This commit is contained in:
parent
9e3045dae1
commit
c275673dbf
@ -1055,6 +1055,7 @@ void BRepFeat_MakeRevolutionForm::Perform()
|
|||||||
if(ex1.Current().IsSame(e1)) {
|
if(ex1.Current().IsSame(e1)) {
|
||||||
myLFMap(iter.Key()).Clear();
|
myLFMap(iter.Key()).Clear();
|
||||||
myLFMap(iter.Key()).Append(ex2.Current());
|
myLFMap(iter.Key()).Append(ex2.Current());
|
||||||
|
break; // break the cycle (e1 became a dead reference)
|
||||||
}
|
}
|
||||||
ex2.Next();
|
ex2.Next();
|
||||||
}
|
}
|
||||||
@ -1062,16 +1063,14 @@ void BRepFeat_MakeRevolutionForm::Perform()
|
|||||||
|
|
||||||
TopTools_DataMapIteratorOfDataMapOfShapeListOfShape iter1(mySlface);
|
TopTools_DataMapIteratorOfDataMapOfShapeListOfShape iter1(mySlface);
|
||||||
for(; iter1.More(); iter1.Next()) {
|
for(; iter1.More(); iter1.Next()) {
|
||||||
const TopoDS_Shape& f1 = iter1.Key();
|
|
||||||
const TopoDS_Shape& e1 = iter1.Value().First();
|
const TopoDS_Shape& e1 = iter1.Value().First();
|
||||||
TopExp_Explorer ex1(myPbase, TopAbs_EDGE);
|
TopExp_Explorer ex1(myPbase, TopAbs_EDGE);
|
||||||
TopExp_Explorer ex2(Pbase, TopAbs_EDGE);
|
TopExp_Explorer ex2(Pbase, TopAbs_EDGE);
|
||||||
for(; ex1.More(); ex1.Next()) {
|
for(; ex1.More(); ex1.Next()) {
|
||||||
const TopoDS_Shape& E1 = ex1.Current();
|
if(ex1.Current().IsSame(e1)) {
|
||||||
const TopoDS_Shape& E2 = ex2.Current();
|
mySlface(iter1.Key()).Clear();
|
||||||
if(E1.IsSame(e1)) {
|
mySlface(iter1.Key()).Append(ex2.Current());
|
||||||
mySlface(f1).Clear();
|
break; // break the cycle (e1 became a dead reference)
|
||||||
mySlface(f1).Append(E2);
|
|
||||||
}
|
}
|
||||||
ex2.Next();
|
ex2.Next();
|
||||||
}
|
}
|
||||||
@ -1158,9 +1157,9 @@ void BRepFeat_MakeRevolutionForm::Perform()
|
|||||||
const TopoDS_Shape& sh = it1.Value().First();
|
const TopoDS_Shape& sh = it1.Value().First();
|
||||||
exx.Init(VraiForm, TopAbs_FACE);
|
exx.Init(VraiForm, TopAbs_FACE);
|
||||||
for(; exx.More(); exx.Next()) {
|
for(; exx.More(); exx.Next()) {
|
||||||
const TopoDS_Face& fac = TopoDS::Face(exx.Current());
|
TopoDS_Face fac = TopoDS::Face(exx.Current());
|
||||||
TopExp_Explorer exx1(fac, TopAbs_WIRE);
|
TopExp_Explorer exx1(fac, TopAbs_WIRE);
|
||||||
const TopoDS_Wire& thew = TopoDS::Wire(exx1.Current());
|
TopoDS_Wire thew = TopoDS::Wire(exx1.Current());
|
||||||
if(thew.IsSame(myFShape)) {
|
if(thew.IsSame(myFShape)) {
|
||||||
const TopTools_ListOfShape& desfaces = trP.Modified(f2);
|
const TopTools_ListOfShape& desfaces = trP.Modified(f2);
|
||||||
myMap(myFShape) = desfaces;
|
myMap(myFShape) = desfaces;
|
||||||
@ -1172,13 +1171,13 @@ void BRepFeat_MakeRevolutionForm::Perform()
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if(fac.IsSame(sh)) {
|
if(fac.IsSame(sh)) {
|
||||||
if (trP.IsDeleted(fac)) {
|
if (! trP.IsDeleted(fac))
|
||||||
}
|
{
|
||||||
else {
|
|
||||||
const TopTools_ListOfShape& desfaces = trP.Modified(fac);
|
const TopTools_ListOfShape& desfaces = trP.Modified(fac);
|
||||||
if(!desfaces.IsEmpty()) {
|
if(!desfaces.IsEmpty()) {
|
||||||
myMap(orig).Clear();
|
myMap(orig).Clear();
|
||||||
myMap(orig) = trP.Modified(fac);
|
myMap(orig) = trP.Modified(fac);
|
||||||
|
break; // break the cycle (sh became a dead reference)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user