From cb6cad7df1a75d09d6467a299b7ba6635e407980 Mon Sep 17 00:00:00 2001 From: kgv Date: Sat, 16 Mar 2019 16:08:27 +0300 Subject: [PATCH] 0023838: Modeling Data - Standard_OutOfRange in Geom_OffsetSurface::LocalDN (called by BRepFill_PipeShell) Fixed incorrect array allocation within GeomEvaluator_OffsetSurface::CalculateDN() and protection against assigning out-of-range values in case of non-square number of U and V derivatives on surface. --- src/GeomEvaluator/GeomEvaluator_OffsetSurface.cxx | 12 ++++++++++-- tests/bugs/modalg_7/bug23838 | 9 +-------- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/src/GeomEvaluator/GeomEvaluator_OffsetSurface.cxx b/src/GeomEvaluator/GeomEvaluator_OffsetSurface.cxx index 6943c9231e..d2fcead403 100644 --- a/src/GeomEvaluator/GeomEvaluator_OffsetSurface.cxx +++ b/src/GeomEvaluator/GeomEvaluator_OffsetSurface.cxx @@ -191,13 +191,21 @@ static void derivatives(Standard_Integer theMaxOrder, else { for (i = 0; i <= theMaxOrder + theNU+ 1; i++) + { for (j = i; j <= theMaxOrder + theNV + 1; j++) + { if (i + j > theMinOrder) { theDerSurf.SetValue(i, j, theBasisSurf->DN(theU, theV, i, j)); - if (i != j) + if (i != j + && j <= theDerSurf.UpperRow() + && i <= theDerSurf.UpperCol()) + { theDerSurf.SetValue(j, i, theBasisSurf->DN(theU, theV, j, i)); + } } + } + } for (i = 0; i <= theMaxOrder + theNU; i++) for (j = 0; j <= theMaxOrder + theNV; j++) theDerNUV.SetValue(i, j, CSLib::DNNUV(i, j, theDerSurf)); @@ -776,7 +784,7 @@ gp_Vec GeomEvaluator_OffsetSurface::CalculateDN( CSLib::Normal(theD1U, theD1V, the_D1MagTol, NStatus, Normal); const Standard_Integer MaxOrder = (NStatus == CSLib_Defined) ? 0 : 3; Standard_Integer OrderU, OrderV; - TColgp_Array2OfVec DerNUV(0, MaxOrder + theNu, 0, MaxOrder + theNu); + TColgp_Array2OfVec DerNUV(0, MaxOrder + theNu, 0, MaxOrder + theNv); TColgp_Array2OfVec DerSurf(0, MaxOrder + theNu + 1, 0, MaxOrder + theNv + 1); Standard_Real Umin = 0, Umax = 0, Vmin = 0, Vmax = 0; diff --git a/tests/bugs/modalg_7/bug23838 b/tests/bugs/modalg_7/bug23838 index 075daa18b6..62366ef0c4 100644 --- a/tests/bugs/modalg_7/bug23838 +++ b/tests/bugs/modalg_7/bug23838 @@ -1,14 +1,7 @@ -puts "TODO OCC23838 Windows: OSD_Exception_ACCESS_VIOLATION" -puts "TODO OCC23838 Linux: segmentation violation" -puts "TODO OCC23838 ALL:TEST INCOMPLETE" - puts "============" -puts "OCC23838" +puts "0023838: Modeling Data - Standard_Out Of Range in Geom_OffsetSurface::LocalDN (called by BRepFill_PipeShell)" puts "============" puts "" -####################################################### -# Standard_OutOfRange in Geom_OffsetSurface::LocalDN (called by BRepFill_PipeShell) -####################################################### restore [locate_data_file bug23838_profile.brep] prof restore [locate_data_file bug23838_SpineAndSupport.brep] comp -- 2.20.1