mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-04-03 17:56:21 +03:00
0032041: Modeling Data - Access violation ExchangeUV in Geom_BezierSurface
Added missing NULL-checks to Geom_BezierSurface::ExchangeUV() and Geom_BSplineSurface::ExchangeUV().
This commit is contained in:
parent
cfb54c0c0a
commit
83746de803
@ -300,48 +300,37 @@ void Geom_BSplineSurface::ExchangeUV ()
|
||||
Standard_Integer LR = poles->LowerRow();
|
||||
Standard_Integer UR = poles->UpperRow();
|
||||
|
||||
Handle(TColgp_HArray2OfPnt) npoles =
|
||||
new TColgp_HArray2OfPnt (LC, UC, LR, UR);
|
||||
Handle(TColStd_HArray2OfReal) nweights =
|
||||
new TColStd_HArray2OfReal (LC, UC, LR, UR);
|
||||
|
||||
const TColgp_Array2OfPnt & spoles = poles->Array2();
|
||||
const TColStd_Array2OfReal & sweights = weights->Array2();
|
||||
|
||||
TColgp_Array2OfPnt& snpoles = npoles->ChangeArray2();
|
||||
TColStd_Array2OfReal& snweights = nweights->ChangeArray2();
|
||||
|
||||
Standard_Integer i, j;
|
||||
for (i = LC; i <= UC; i++) {
|
||||
for (j = LR; j <= UR; j++) {
|
||||
snpoles (i,j) = spoles (j,i);
|
||||
snweights (i,j) = sweights (j,i);
|
||||
}
|
||||
Handle(TColgp_HArray2OfPnt) npoles = new TColgp_HArray2OfPnt (LC, UC, LR, UR);
|
||||
Handle(TColStd_HArray2OfReal) nweights;
|
||||
if (!weights.IsNull())
|
||||
{
|
||||
nweights = new TColStd_HArray2OfReal (LC, UC, LR, UR);
|
||||
}
|
||||
|
||||
const TColgp_Array2OfPnt& spoles = poles->Array2();
|
||||
const TColStd_Array2OfReal* sweights = !weights.IsNull() ? &weights->Array2() : NULL;
|
||||
|
||||
TColgp_Array2OfPnt& snpoles = npoles->ChangeArray2();
|
||||
TColStd_Array2OfReal* snweights = !nweights.IsNull() ? &nweights->ChangeArray2() : NULL;
|
||||
for (Standard_Integer i = LC; i <= UC; i++)
|
||||
{
|
||||
for (Standard_Integer j = LR; j <= UR; j++)
|
||||
{
|
||||
snpoles (i, j) = spoles (j, i);
|
||||
if (snweights != NULL)
|
||||
{
|
||||
snweights->ChangeValue (i, j) = sweights->Value (j, i);
|
||||
}
|
||||
}
|
||||
}
|
||||
poles = npoles;
|
||||
weights = nweights;
|
||||
|
||||
Standard_Boolean temp = urational;
|
||||
urational = vrational;
|
||||
vrational = temp;
|
||||
|
||||
temp = uperiodic;
|
||||
uperiodic = vperiodic;
|
||||
vperiodic = temp;
|
||||
|
||||
Standard_Integer tempdeg = udeg;
|
||||
udeg = vdeg;
|
||||
vdeg = tempdeg;
|
||||
|
||||
|
||||
Handle(TColStd_HArray1OfReal) tempknots = uknots;
|
||||
uknots = vknots;
|
||||
vknots = tempknots;
|
||||
|
||||
Handle(TColStd_HArray1OfInteger) tempmults = umults;
|
||||
umults = vmults;
|
||||
vmults = tempmults;
|
||||
std::swap (urational, vrational);
|
||||
std::swap (uperiodic, vperiodic);
|
||||
std::swap (udeg, vdeg);
|
||||
std::swap (uknots, vknots);
|
||||
std::swap (umults, vmults);
|
||||
|
||||
UpdateUKnots();
|
||||
UpdateVKnots();
|
||||
|
@ -505,31 +505,33 @@ void Geom_BezierSurface::ExchangeUV ()
|
||||
Standard_Integer LR = poles->LowerRow();
|
||||
Standard_Integer UR = poles->UpperRow();
|
||||
|
||||
Handle(TColgp_HArray2OfPnt) npoles =
|
||||
new TColgp_HArray2OfPnt (LC, UC, LR, UR);
|
||||
Handle(TColStd_HArray2OfReal) nweights =
|
||||
new TColStd_HArray2OfReal (LC, UC, LR, UR);
|
||||
|
||||
const TColgp_Array2OfPnt & spoles = poles->Array2();
|
||||
const TColStd_Array2OfReal & sweights = weights->Array2();
|
||||
|
||||
TColgp_Array2OfPnt& snpoles = npoles->ChangeArray2();
|
||||
TColStd_Array2OfReal& snweights = nweights->ChangeArray2();
|
||||
|
||||
Standard_Integer i, j;
|
||||
for (i = LC; i <= UC; i++) {
|
||||
for (j = LR; j <= UR; j++) {
|
||||
snpoles (i,j) = spoles (j,i);
|
||||
snweights (i,j) = sweights (j,i);
|
||||
}
|
||||
Handle(TColgp_HArray2OfPnt) npoles = new TColgp_HArray2OfPnt (LC, UC, LR, UR);
|
||||
Handle(TColStd_HArray2OfReal) nweights;
|
||||
if (!weights.IsNull())
|
||||
{
|
||||
nweights = new TColStd_HArray2OfReal (LC, UC, LR, UR);
|
||||
}
|
||||
|
||||
const TColgp_Array2OfPnt& spoles = poles->Array2();
|
||||
const TColStd_Array2OfReal* sweights = !weights.IsNull() ? &weights->Array2() : NULL;
|
||||
|
||||
TColgp_Array2OfPnt& snpoles = npoles->ChangeArray2();
|
||||
TColStd_Array2OfReal* snweights = !nweights.IsNull() ? &nweights->ChangeArray2() : NULL;
|
||||
for (Standard_Integer i = LC; i <= UC; i++)
|
||||
{
|
||||
for (Standard_Integer j = LR; j <= UR; j++)
|
||||
{
|
||||
snpoles (i, j) = spoles (j, i);
|
||||
if (snweights != NULL)
|
||||
{
|
||||
snweights->ChangeValue (i, j) = sweights->Value (j, i);
|
||||
}
|
||||
}
|
||||
}
|
||||
poles = npoles;
|
||||
weights = nweights;
|
||||
|
||||
Standard_Boolean temp = urational;
|
||||
urational = vrational;
|
||||
vrational = temp;
|
||||
std::swap (urational, vrational);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
|
12
tests/bugs/moddata_3/bug32041
Normal file
12
tests/bugs/moddata_3/bug32041
Normal file
@ -0,0 +1,12 @@
|
||||
puts "========="
|
||||
puts "0032041: Modeling Data - Access v i o l a t i o n ExchangeUV in Geom_BezierSurface"
|
||||
puts "========="
|
||||
puts ""
|
||||
|
||||
pload MODELING
|
||||
beziersurf bs 4 4 0 0 0 4 0 0 8 0 0 12 0 0 0 4 0 4 4 1 8 4 0 12 4 0 0 8 0 4 8 0 8 8 -1 12 8 0 0 12 0 4 12 0 8 12 0 12 12 0
|
||||
smallview
|
||||
fit
|
||||
xwd ${imagedir}/${casename}_1.png
|
||||
exchuv bs
|
||||
xwd ${imagedir}/${casename}_2.png
|
Loading…
x
Reference in New Issue
Block a user