mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-04-10 18:51:21 +03:00
0024081: Memory corruption when projecting point on surface of revolution
Adding test cases for issue CR24081
This commit is contained in:
parent
f4ea2ca675
commit
6f94f1dff9
@ -105,7 +105,7 @@ fields
|
|||||||
|
|
||||||
myDone : Boolean;
|
myDone : Boolean;
|
||||||
myNbExt: Integer;
|
myNbExt: Integer;
|
||||||
mySqDist: Real [6];
|
mySqDist: Real [8];
|
||||||
myPoint: POnSurf from Extrema [6];
|
myPoint: POnSurf from Extrema [8];
|
||||||
|
|
||||||
end ExtPRevS;
|
end ExtPRevS;
|
||||||
|
@ -174,7 +174,7 @@ static Standard_Boolean IsOriginalPnt (const gp_Pnt& P,
|
|||||||
const Standard_Integer NbPoints)
|
const Standard_Integer NbPoints)
|
||||||
{
|
{
|
||||||
for (Standard_Integer i=1; i<=NbPoints; i++) {
|
for (Standard_Integer i=1; i<=NbPoints; i++) {
|
||||||
if (Points[i].Value().IsEqual(P, Precision::Confusion())) {
|
if (Points[i-1].Value().IsEqual(P, Precision::Confusion())) {
|
||||||
return Standard_False;
|
return Standard_False;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -407,8 +407,9 @@ void Extrema_ExtPRevS::Perform(const gp_Pnt& P)
|
|||||||
Dist2 = P.SquareDistance(E);
|
Dist2 = P.SquareDistance(E);
|
||||||
}
|
}
|
||||||
if (IsOriginalPnt(E, myPoint, myNbExt)) {
|
if (IsOriginalPnt(E, myPoint, myNbExt)) {
|
||||||
myPoint[++myNbExt] = Extrema_POnSurf(U,V,E);
|
myPoint[myNbExt] = Extrema_POnSurf(U,V,E);
|
||||||
mySqDist[myNbExt] = Dist2;
|
mySqDist[myNbExt] = Dist2;
|
||||||
|
myNbExt++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -476,9 +477,9 @@ void Extrema_ExtPRevS::Perform(const gp_Pnt& P)
|
|||||||
Dist2 = P.SquareDistance(E);
|
Dist2 = P.SquareDistance(E);
|
||||||
}
|
}
|
||||||
if (IsOriginalPnt(E, myPoint, myNbExt)) {
|
if (IsOriginalPnt(E, myPoint, myNbExt)) {
|
||||||
myPoint[++myNbExt] = Extrema_POnSurf(U,V,E);
|
myPoint[myNbExt] = Extrema_POnSurf(U,V,E);
|
||||||
mySqDist[myNbExt] = Dist2;
|
mySqDist[myNbExt] = Dist2;
|
||||||
|
myNbExt++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -518,7 +519,7 @@ Standard_Real Extrema_ExtPRevS::SquareDistance(const Standard_Integer N) const
|
|||||||
if (!IsDone()) { StdFail_NotDone::Raise(); }
|
if (!IsDone()) { StdFail_NotDone::Raise(); }
|
||||||
if ((N < 1) || (N > myNbExt)) { Standard_OutOfRange::Raise(); }
|
if ((N < 1) || (N > myNbExt)) { Standard_OutOfRange::Raise(); }
|
||||||
if (myIsAnalyticallyComputable)
|
if (myIsAnalyticallyComputable)
|
||||||
return mySqDist[N];
|
return mySqDist[N-1];
|
||||||
else
|
else
|
||||||
return myExtPS.SquareDistance(N);
|
return myExtPS.SquareDistance(N);
|
||||||
}
|
}
|
||||||
@ -532,7 +533,7 @@ Extrema_POnSurf Extrema_ExtPRevS::Point(const Standard_Integer N) const
|
|||||||
if (!IsDone()) { StdFail_NotDone::Raise(); }
|
if (!IsDone()) { StdFail_NotDone::Raise(); }
|
||||||
if ((N < 1) || (N > myNbExt)) { Standard_OutOfRange::Raise(); }
|
if ((N < 1) || (N > myNbExt)) { Standard_OutOfRange::Raise(); }
|
||||||
if (myIsAnalyticallyComputable)
|
if (myIsAnalyticallyComputable)
|
||||||
return myPoint[N];
|
return myPoint[N-1];
|
||||||
else
|
else
|
||||||
return myExtPS.Point(N);
|
return myExtPS.Point(N);
|
||||||
}
|
}
|
||||||
|
11
tests/bugs/moddata_3/bug24081_1
Normal file
11
tests/bugs/moddata_3/bug24081_1
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
puts "================"
|
||||||
|
puts "CR24081"
|
||||||
|
puts "================"
|
||||||
|
puts ""
|
||||||
|
#######################################################################
|
||||||
|
# Memory corruption when projecting point on surface of revolution
|
||||||
|
#######################################################################
|
||||||
|
|
||||||
|
ellipse e 10 0 0 0 -1 0 0 0 1 5 2
|
||||||
|
revsurf s e 0 0 0 0 0 1
|
||||||
|
proj s 7.9 0 0
|
11
tests/bugs/moddata_3/bug24081_2
Normal file
11
tests/bugs/moddata_3/bug24081_2
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
puts "================"
|
||||||
|
puts "CR24081"
|
||||||
|
puts "================"
|
||||||
|
puts ""
|
||||||
|
#######################################################################
|
||||||
|
# Memory corruption when projecting point on surface of revolution
|
||||||
|
#######################################################################
|
||||||
|
|
||||||
|
ellipse e 2.1 0 0 0 -1 0 0 0 1 5 2
|
||||||
|
revsurf s e 0 0 0 0 0 1
|
||||||
|
proj s 0.01 0 0
|
Loading…
x
Reference in New Issue
Block a user