mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-04-10 18:51: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 LR = poles->LowerRow();
|
||||||
Standard_Integer UR = poles->UpperRow();
|
Standard_Integer UR = poles->UpperRow();
|
||||||
|
|
||||||
Handle(TColgp_HArray2OfPnt) npoles =
|
Handle(TColgp_HArray2OfPnt) npoles = new TColgp_HArray2OfPnt (LC, UC, LR, UR);
|
||||||
new TColgp_HArray2OfPnt (LC, UC, LR, UR);
|
Handle(TColStd_HArray2OfReal) nweights;
|
||||||
Handle(TColStd_HArray2OfReal) nweights =
|
if (!weights.IsNull())
|
||||||
new TColStd_HArray2OfReal (LC, UC, LR, UR);
|
{
|
||||||
|
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);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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;
|
poles = npoles;
|
||||||
weights = nweights;
|
weights = nweights;
|
||||||
|
|
||||||
Standard_Boolean temp = urational;
|
std::swap (urational, vrational);
|
||||||
urational = vrational;
|
std::swap (uperiodic, vperiodic);
|
||||||
vrational = temp;
|
std::swap (udeg, vdeg);
|
||||||
|
std::swap (uknots, vknots);
|
||||||
temp = uperiodic;
|
std::swap (umults, vmults);
|
||||||
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;
|
|
||||||
|
|
||||||
UpdateUKnots();
|
UpdateUKnots();
|
||||||
UpdateVKnots();
|
UpdateVKnots();
|
||||||
|
@ -505,31 +505,33 @@ void Geom_BezierSurface::ExchangeUV ()
|
|||||||
Standard_Integer LR = poles->LowerRow();
|
Standard_Integer LR = poles->LowerRow();
|
||||||
Standard_Integer UR = poles->UpperRow();
|
Standard_Integer UR = poles->UpperRow();
|
||||||
|
|
||||||
Handle(TColgp_HArray2OfPnt) npoles =
|
Handle(TColgp_HArray2OfPnt) npoles = new TColgp_HArray2OfPnt (LC, UC, LR, UR);
|
||||||
new TColgp_HArray2OfPnt (LC, UC, LR, UR);
|
Handle(TColStd_HArray2OfReal) nweights;
|
||||||
Handle(TColStd_HArray2OfReal) nweights =
|
if (!weights.IsNull())
|
||||||
new TColStd_HArray2OfReal (LC, UC, LR, UR);
|
{
|
||||||
|
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);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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;
|
poles = npoles;
|
||||||
weights = nweights;
|
weights = nweights;
|
||||||
|
|
||||||
Standard_Boolean temp = urational;
|
std::swap (urational, vrational);
|
||||||
urational = vrational;
|
|
||||||
vrational = temp;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
|
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