From 7e425ba7b0ed5c17d6785a6e32eeef371f8a7af0 Mon Sep 17 00:00:00 2001 From: nbv Date: Tue, 18 Sep 2018 11:10:19 +0300 Subject: [PATCH] 0030140: Modeling Algorithms - Access Null Pointer The array TabP has been allocated correctly. --- src/GeomFill/GeomFill_CorrectedFrenet.cxx | 1 + tests/bugs/modalg_7/bug30140 | 22 ++++++++++++++++++++++ 2 files changed, 23 insertions(+) create mode 100644 tests/bugs/modalg_7/bug30140 diff --git a/src/GeomFill/GeomFill_CorrectedFrenet.cxx b/src/GeomFill/GeomFill_CorrectedFrenet.cxx index 9f46ff516a..727938c1ac 100644 --- a/src/GeomFill/GeomFill_CorrectedFrenet.cxx +++ b/src/GeomFill/GeomFill_CorrectedFrenet.cxx @@ -270,6 +270,7 @@ static Standard_Boolean FindPlane ( const Handle(Adaptor3d_HCurve)& theC, f = theC->FirstParameter(); l = theC->LastParameter(); inv = 1./(nbp-1); + TabP = new (TColgp_HArray1OfPnt) (1, nbp); for (ii=1; ii<=nbp; ii++) { t = ( f*(nbp-ii) + l*(ii-1)); t *= inv; diff --git a/tests/bugs/modalg_7/bug30140 b/tests/bugs/modalg_7/bug30140 new file mode 100644 index 0000000000..567eff4021 --- /dev/null +++ b/tests/bugs/modalg_7/bug30140 @@ -0,0 +1,22 @@ +puts "========" +puts "0030140: Modeling Algorithms - Access Null Pointer" +puts "========" +puts "" + +line l_path 0 0 0 1 0 0 +trim l_path l_path 0 10 +circle c_profile 0 0 2 1 0 0 5 +mkedge profile c_profile +wire profile profile +point dir 0 1 0 +offsetcurve offset_path l_path 2 dir +mkedge path offset_path +wire path path + +# Before the fix - Exception. +pipe result path profile 0 + +checkshape result +checkprops result -s 314.159 + +checkview -display result -2d -path ${imagedir}/${test_image}.png \ No newline at end of file