mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-04-10 18:51:21 +03:00
0024383: Access violation during STEP file import
Protection for null magnitude of vector written in file was added. Test cases for issue CR24383
This commit is contained in:
parent
566f84411f
commit
5cc18856ae
@ -32,6 +32,7 @@
|
|||||||
#include <gp_Pnt.hxx>
|
#include <gp_Pnt.hxx>
|
||||||
#include <gp_Vec.hxx>
|
#include <gp_Vec.hxx>
|
||||||
#include <gp_Dir.hxx>
|
#include <gp_Dir.hxx>
|
||||||
|
#include <Precision.hxx>
|
||||||
|
|
||||||
//=============================================================================
|
//=============================================================================
|
||||||
// Creation d' une Line de Geom a partir d' une Line de Step
|
// Creation d' une Line de Geom a partir d' une Line de Step
|
||||||
@ -46,6 +47,8 @@ Standard_Boolean StepToGeom_MakeLine::Convert (const Handle(StepGeom_Line)& SC,
|
|||||||
Handle(Geom_VectorWithMagnitude) D;
|
Handle(Geom_VectorWithMagnitude) D;
|
||||||
if (StepToGeom_MakeVectorWithMagnitude::Convert(SC->Dir(),D))
|
if (StepToGeom_MakeVectorWithMagnitude::Convert(SC->Dir(),D))
|
||||||
{
|
{
|
||||||
|
if( D->Vec().SquareMagnitude() < Precision::Confusion() * Precision::Confusion())
|
||||||
|
return Standard_False;
|
||||||
const gp_Dir V(D->Vec());
|
const gp_Dir V(D->Vec());
|
||||||
CC = new Geom_Line(P->Pnt(), V);
|
CC = new Geom_Line(P->Pnt(), V);
|
||||||
return Standard_True;
|
return Standard_True;
|
||||||
|
10
tests/bugs/step/bug24383
Executable file
10
tests/bugs/step/bug24383
Executable file
@ -0,0 +1,10 @@
|
|||||||
|
puts "============"
|
||||||
|
puts "OCC24383"
|
||||||
|
puts "============"
|
||||||
|
puts ""
|
||||||
|
#######################################################################
|
||||||
|
# Access violation during STEP file import
|
||||||
|
#######################################################################
|
||||||
|
|
||||||
|
ReadStep D [locate_data_file bug24383_224013.stp]
|
||||||
|
|
Loading…
x
Reference in New Issue
Block a user