From de07af824b32d0daadbb8b5b93e6bad01bf12638 Mon Sep 17 00:00:00 2001 From: kgv Date: Wed, 20 Mar 2019 09:50:52 +0300 Subject: [PATCH] 0030594: Data Exchange - access violation within IGESGeom_BSplineCurve constructor Added NULL check. --- src/IGESGeom/IGESGeom_BSplineCurve.cxx | 24 +++++++++++++++++------- tests/de/iges_2/E4 | 2 +- 2 files changed, 18 insertions(+), 8 deletions(-) diff --git a/src/IGESGeom/IGESGeom_BSplineCurve.cxx b/src/IGESGeom/IGESGeom_BSplineCurve.cxx index 2621a11541..8bc79f210c 100644 --- a/src/IGESGeom/IGESGeom_BSplineCurve.cxx +++ b/src/IGESGeom/IGESGeom_BSplineCurve.cxx @@ -40,13 +40,23 @@ IGESGeom_BSplineCurve::IGESGeom_BSplineCurve () { } const Standard_Real aUmin, const Standard_Real aUmax, const gp_XYZ& aNorm) { - if (!allPoles.IsNull()) { - if (allPoles->Length() != allWeights->Length()) - throw Standard_DimensionMismatch("IGESGeom_BSplineCurve : Init"); - if (allKnots->Lower() != -aDegree || allKnots->Upper() != anIndex+1 || - allWeights->Upper() != anIndex || - allWeights->Lower() != 0 || allPoles->Lower() != 0) - throw Standard_DimensionMismatch("IGESGeom_BSplineCurve : Init"); + if (!allPoles.IsNull()) + { + if (allKnots->Lower() != -aDegree + || allKnots->Upper() != anIndex + 1 + || allPoles->Lower() != 0) + { + throw Standard_DimensionMismatch ("IGESGeom_BSplineCurve : Init"); + } + if (!allWeights.IsNull()) + { + if (allPoles->Length() != allWeights->Length() + || allWeights->Upper() != anIndex + || allWeights->Lower() != 0) + { + throw Standard_DimensionMismatch ("IGESGeom_BSplineCurve : Init"); + } + } } theIndex = anIndex; diff --git a/tests/de/iges_2/E4 b/tests/de/iges_2/E4 index 4295e63def..7ac6786dee 100644 --- a/tests/de/iges_2/E4 +++ b/tests/de/iges_2/E4 @@ -6,7 +6,7 @@ puts "TODO CR23096 ALL: COLORS : Faulty" set filename igsBF5.igs set ref_data { -DATA : Faulties = 0 ( 0 ) Warnings = 0 ( 1 ) Summary = 0 ( 1 ) +DATA : Faulties = 0 ( 2152 ) Warnings = 0 ( 1 ) Summary = 0 ( 2153 ) TPSTAT : Faulties = 0 ( 0 ) Warnings = 17 ( 249 ) Summary = 17 ( 249 ) CHECKSHAPE : Wires = 0 ( 0 ) Faces = 0 ( 0 ) Shells = 0 ( 0 ) Solids = 0 ( 0 ) NBSHAPES : Solid = 0 ( 0 ) Shell = 0 ( 0 ) Face = 47 ( 47 )