Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.


#329 segfault on reading solidworks, undefined enitites

crash or data loss
Sean Morrison

using v7.22.0
segault importing step file :

/usr/brlcad/bin/step-g -o 01-001-00-0.g 01-001-00-0.STEP > err.txt 2>&1

Missing these entities :grep 'Unknown ENTITY' err.txt | cut "-d'" -f2 | cut -d: -f1 | sort -u


Example :
ERROR: instance #1 'COLOUR_RGB': Unknown ENTITY type.

Which is defined in the exp files :
data/cd242/242_n2813_mim_lf.exp:ENTITY colour_rgb
data/ap210e2/ap210e2_v1_40_mim_lf.exp:ENTITY colour_rgb
data/ap203e2/ap203e2_mim_lf.exp:ENTITY colour_rgb
data/cd209/part409cdts_wg3n2617mim_lf.exp:ENTITY colour_rgb
data/wip210e3/210e3_wip_v1_41_mim_lf.exp:ENTITY colour_rgb
data/ap227/ap227.exp: ENTITY colour_rgb

The segfault :
Used 45 entities of the available 254 in schema "Config_Control_Design
Writing output file [01-001-00-02.g] ...
Program received signal SIGSEGV, Segmentation fault.
0x00007fffe8abd3f5 in TypeDescriptor::Name(char const*) const () from /usr/brlcad/lib/
(gdb) bt
#0 0x00007fffe8abd3f5 in TypeDescriptor::Name(char const*) const () from /usr/brlcad/lib/
#1 0x00007fffe8a9a73d in SDAI_Application_instance::EntityName(char const*) const () from /usr/brlcad/lib/
#2 0x000000000063cede in Factory::CreateObject(STEPWrapper*, SDAI_Application_instance*) ()
#3 0x0000000000625dbb in ConnectedFaceSet::Load(STEPWrapper*, SDAI_Application_instance*) ()
#4 0x0000000000620e2c in ClosedShell::Load(STEPWrapper*, SDAI_Application_instance*) ()
#5 0x0000000000620f50 in ClosedShell::Create(STEPWrapper*, SDAI_Application_instance*) ()
#6 0x000000000063d13d in Factory::CreateObject(STEPWrapper*, SDAI_Application_instance*) ()
#7 0x000000000064c976 in ManifoldSolidBrep::Load(STEPWrapper*, SDAI_Application_instance*) ()
#8 0x000000000064ca60 in ManifoldSolidBrep::Create(STEPWrapper*, SDAI_Application_instance*) ()
#9 0x000000000063d13d in Factory::CreateObject(STEPWrapper*, SDAI_Application_instance*) ()
#10 0x0000000000693f38 in Representation::Load(STEPWrapper*, SDAI_Application_instance*) ()
#11 0x000000000069d240 in ShapeRepresentation::Load(STEPWrapper*, SDAI_Application_instance*) ()
#12 0x0000000000603b8c in AdvancedBrepShapeRepresentation::Load(STEPWrapper*, SDAI_Application_instance*) ()
#13 0x00000000006993f2 in STEPWrapper::convert(BRLCADWrapper*) ()
#14 0x00000000006b7d40 in main ()


  • Sean Morrison
    Sean Morrison

    I was able to reproduce the crash using the STEP data. At a quick glance, the problem is likely related to the fact that our parser is built upon the AP203e2 schema and the input file is AP214 data. The "unknown" ERRORs for entities that exist in both AP203 and AP214 are unexpected, but would not be recognized regardless as they're non-geometric (which we do not yet support). The real concern is the crash as you should have at least received a partial import (of all the geometry entities).

    Thanks for the report. It'll take some time to look into this issue given everything else going on right now, but the report is most certainly appreciated. Please update this tracker if you discover any other useful information.

  • Sean Morrison
    Sean Morrison

    • priority: 5 --> 7
    • assigned_to: nobody --> brlcad
    • status: open --> open-accepted

  • Anonymous

    I have reproduced this error with the latest version, am debugging now.

  • Sean Morrison
    Sean Morrison

    Curious that you were able to reproduce the crash. I applied numerous changes last night and was able to achieve a successful import via step-g.

    There's still the unknown entity error lines due to the geometry being AP214 and our parser only recognizing AP203e2 entities. Those warrant inspection, but I highly suspect they are related to the schema mismatch.


  • Anonymous

    I am using a different step file :

    2310 const ON_Surface *surf = (*d)->surftree->getSurface();

    the surf object is way out of bounds.
    more to come


  • Anonymous

    finalgoodpt - -1,0
    finalbadpt - 18.6463,68.0627

    Program received signal SIGSEGV, Segmentation fault.
    0x00007fffe88fb3d6 in has_singularity (surf=0x4808708bf8458b48) at /home/h4ck3rm1k3/experiments/brlcad/brlcad/src/libnurbs/PullbackCurve.cpp:1508
    1508 if (surf->IsSingular(i)) {

    Program received signal SIGSEGV, Segmentation fault.
    0x00007fffe88fb3d6 in has_singularity (surf=0x4808708bf8458b48) at /home/h4ck3rm1k3/experiments/brlcad/brlcad/src/libnurbs/PullbackCurve.cpp:1508
    1508 if (surf->IsSingular(i)) {
    (gdb) p surf
    $5 = (class ON_Surface *) 0x4808708bf8458b48
    (gdb) up
    #1 0x00007fffe88fe3f1 in check_pullback_data (pbcs=@0x7fffffffe330) at /home/h4ck3rm1k3/experiments/brlcad/brlcad/src/libnurbs/PullbackCurve.cpp:2314
    2314 bool singular = has_singularity(surf);

    (gdb) bt
    #0 0x00007fffe88fb3d6 in has_singularity (surf=0x4808708bf8458b48) at /home/h4ck3rm1k3/experiments/brlcad/brlcad/src/libnurbs/PullbackCurve.cpp:1508
    #1 0x00007fffe88fe3f1 in check_pullback_data (pbcs=@0x7fffffffe330) at /home/h4ck3rm1k3/experiments/brlcad/brlcad/src/libnurbs/PullbackCurve.cpp:2314
    #2 0x00000000006d75f7 in Path::LoadONTrimmingCurves (this=0x1b12ee40, brep=0x1b141f00) at /home/h4ck3rm1k3/experiments/brlcad/brlcad/src/conv/step/OpenNurbsInterfaces.cpp:1408
    #3 0x00000000006d7e89 in Path::LoadONBrep (this=0x1b12ee40, brep=0x1b141f00) at /home/h4ck3rm1k3/experiments/brlcad/brlcad/src/conv/step/OpenNurbsInterfaces.cpp:1268
    #4 0x000000000069bacd in EdgeLoop::LoadONBrep (this=0x1b12ee30, brep=0x1b141f00) at /home/h4ck3rm1k3/experiments/brlcad/brlcad/src/conv/step/EdgeLoop.cpp:100
    #5 0x00000000006d87e3 in FaceBound::LoadONBrep (this=0x1b12edb0, brep=0x1b141f00) at /home/h4ck3rm1k3/experiments/brlcad/brlcad/src/conv/step/OpenNurbsInterfaces.cpp:1119
    #6 0x00000000006d88b7 in FaceOuterBound::LoadONBrep (this=0x1b12edb0, brep=0x1b141f00) at /home/h4ck3rm1k3/experiments/brlcad/brlcad/src/conv/step/OpenNurbsInterfaces.cpp:1085
    #7 0x00000000006cf1c7 in Face::LoadONBrep (this=0x1b12ed40, brep=0x1b141f00) at /home/h4ck3rm1k3/experiments/brlcad/brlcad/src/conv/step/OpenNurbsInterfaces.cpp:1065
    #8 0x00000000006d9867 in FaceSurface::LoadONBrep (this=0x1b12ed40, brep=0x1b141f00) at /home/h4ck3rm1k3/experiments/brlcad/brlcad/src/conv/step/OpenNurbsInterfaces.cpp:959
    #9 0x000000000065d01c in AdvancedFace::LoadONBrep (this=0x1b12ed40, brep=0x1b141f00) at /home/h4ck3rm1k3/experiments/brlcad/brlcad/src/conv/step/AdvancedFace.cpp:94
    #10 0x000000000068a925 in ConnectedFaceSet::LoadONBrep (this=0x1ac4ad40, brep=0x1b141f00) at /home/h4ck3rm1k3/experiments/brlcad/brlcad/src/conv/step/ConnectedFaceSet.cpp:150
    #11 0x00000000006839ea in ClosedShell::LoadONBrep (this=0x1ac4ad40, brep=0x1b141f00) at /home/h4ck3rm1k3/experiments/brlcad/brlcad/src/conv/step/ClosedShell.cpp:97
    #12 0x00000000006c2c11 in ManifoldSolidBrep::LoadONBrep (this=0x1ac20df0, brep=0x1b141f00) at /home/h4ck3rm1k3/experiments/brlcad/brlcad/src/conv/step/ManifoldSolidBrep.cpp:116
    #13 0x00000000006cf0b6 in AdvancedBrepShapeRepresentation::LoadONBrep (this=0x1ac4ad90, brep=0x1b141f00) at /home/h4ck3rm1k3/experiments/brlcad/brlcad/src/conv/step/OpenNurbsInterfaces.cpp:131
    #14 0x00000000006dc703 in AdvancedBrepShapeRepresentation::GetONBrep (this=0x1ac4ad90) at /home/h4ck3rm1k3/experiments/brlcad/brlcad/src/conv/step/OpenNurbsInterfaces.cpp:110
    #15 0x000000000071c1ed in STEPWrapper::convert (this=0xa51f20, dot_g=0x4d20600) at /home/h4ck3rm1k3/experiments/brlcad/brlcad/src/conv/step/STEPWrapper.cpp:94
    #16 0x00000000007477fc in main (argc=1, argv=0x7fffffffeac0) at /home/h4ck3rm1k3/experiments/brlcad/brlcad/src/conv/step/step-g.cpp:123

    Last edit: Anonymous 2013-05-05
  • Sean Morrison
    Sean Morrison

    Ah, there are more of them. The way the ISO STEP schema is converted into a parser (automatically) results in some peculiar behavior when you try to read in an AP214 file into our AP203e2 parser. The fixes I made last night allow the parser to propagate null entities, so we have to check and make sure 'surf' is initialize to NULL and isn't NULL before getting dereferenced.