View Issue Details

IDProjectCategoryView StatusLast Update
0002506FreeCADBugpublic2017-03-11 11:53
Reporterfran6tAssigned To 
PrioritylowSeveritycrashReproducibilityalways
Status resolvedResolutionfixed 
PlatformLinuxOSubuntuOS Version14.04 LTS
Product Version 
Target VersionFixed in Version0.17 
Summary0002506: Crash when export .step (due to an upstream OCC bug)
DescriptionWhen export .step Freecad crash
In terminal mode we could see just "The exception is SIGSEGV : 'segmentation violation' detected. Adress 28
Perhaps it's a bug in library libTKXSBase and a catch error is missing ?
I don't know if crash in external libray could be catched and display an error without crash exit of freecad.

Ps: Sorry for my bad english, and sorry by advance if procedure is not good it's my first try report bug.
Steps To ReproduceOpen file debug.fsctd
Select BJ_Socket_005
Export file format .step
Additional InformationAll debug message can be see here :
http://forum.freecadweb.org/viewtopic.php?f=12&t=15235&sid=dc4acd2ec1b8888d3639563222a6fe1a#p121288
TagsOCC Bug, STEP, upstream

Activities

2016-04-14 22:13fran6tNew Issue
2016-04-14 22:13fran6tFile Added: Debug.FCStd
2017-01-09 23:39Kunda1Tag Attached: STEP

fran6t

2016-04-14 22:13

reporter  

Debug.FCStd (Attachment missing)

wmayer

2017-01-10 10:19

administrator   ~0007595

I can confirm the crash. However, this is clearly a bug in OpenCascade which we are not able to fix.
This is the implementation of the function:


//=======================================================================
//function : FindEntities
//purpose : auxilary
//=======================================================================
static Standard_Integer FindEntities (const Handle(Transfer_FinderProcess) &FP,
                      const TopoDS_Shape &S,
                      TopLoc_Location &L,
                      TColStd_SequenceOfTransient &seqRI)
{
  Handle(StepRepr_RepresentationItem) item = STEPConstruct::FindEntity ( FP, S, L );

  if ( ! item.IsNull() ) {
    seqRI.Append ( item );
    return 1;
  }
      
  // may be S was splited during shape processing
  Handle(TransferBRep_ShapeMapper) mapper = TransferBRep::ShapeMapper ( FP, S );
  Handle(Transfer_Binder) bnd = FP->Find ( mapper );
  if ( bnd.IsNull() ) return 0;
  
  Handle(Transfer_TransientListBinder) TransientListBinder =
    //Handle(Transfer_TransientListBinder)::DownCast( bnd->Next(Standard_True) );
    Handle(Transfer_TransientListBinder)::DownCast( bnd );
  Standard_Integer nres=0;
  if ( TransientListBinder.IsNull() && S.ShapeType() == TopAbs_COMPOUND)
  {
    for ( TopoDS_Iterator it(S); it.More(); it.Next() ) {
      Handle(StepRepr_RepresentationItem) aLocalItem = STEPConstruct::FindEntity ( FP, it.Value(), L );
      if (aLocalItem.IsNull() ) continue;
      nres++;
      seqRI.Append (aLocalItem);
    }
  }
  else
  {
    const Standard_Integer nb = TransientListBinder->NbTransients();
    for (Standard_Integer i=1; i<=nb; i++) {
      Handle(Standard_Transient) t = TransientListBinder->Transient(i);
      item = Handle(StepRepr_RepresentationItem)::DownCast(t);
      if ( item.IsNull() ) continue;
      nres++;
      seqRI.Append ( item );
    }
  }
/* works but is obsolete: another approach
  if (i<=nb) {
    TopoDS_Shape comp = TransferBRep::ShapeResult(bnd);
    if ( ! comp.IsNull() && comp.ShapeType() < S.ShapeType() ) {
      for ( TopoDS_Iterator it(comp); it.More(); it.Next() ) {
        MakeSTEPStyles(Styles, it.Value(), settings, STEPstyle,
               Map, ( hasOwn ? &style : 0 ) );
      }
    }
  }
*/
  return nres;
}


TransientListBinder is null but the shape type is a face. So, in this case it doesn't check whether TransientListBinder is null and thus causes a segmentation fault when accessing it.
2017-01-10 10:19wmayerStatusnew => confirmed
2017-01-10 10:19wmayerResolutionopen => not fixable
2017-01-12 15:38Kunda1Tag Attached: OCC Bug
2017-01-12 15:38Kunda1Tag Attached: upstream

Kunda1

2017-01-12 15:40

manager   ~0007673

@wmayer i tagged this as 'upstream'. Is that correct? If so then we should associate this to an upstream ticket.
2017-01-24 12:43Kunda1Tag Attached: #pending
2017-01-24 12:49Kunda1SummaryCrash when export .step => Crash when export .step (due to an upstream OCC bug)

Kunda1

2017-01-24 12:53

manager   ~0007958

Reminder sent to: wmayer

@wmayer can you mention what version the OCC bug is still occurring in? (I assume OCC 7.0?)

Kunda1

2017-03-10 23:19

manager   ~0008605

@NormandC do you mind testing with OCC7.1 to confirm it's still reproducible?

normandc

2017-03-11 04:47

manager   ~0008606

Can't reproduce on current master based on OCCT 7.1.0 exporting to STEP either from File --> Export menu or Part --> Export CAD, choosing either STEP or STEP with colors.

I guess we can say it is fixed.

OS: Ubuntu 16.04.2 LTS
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.17.10460 (Git)
Build type: None
Branch: master
Hash: 91c59c7910436c44ede608e29d9a90a287121a11
Python version: 2.7.12
Qt version: 4.8.7
Coin version: 4.0.0a
OCC version: 7.1.0

Kunda1

2017-03-11 11:52

manager   ~0008611

Thanks NormandC. Upstream fix tested in 0.17 per 0002506:0008606 works.
Resolving.
2017-03-11 11:52Kunda1Statusconfirmed => resolved
2017-03-11 11:52Kunda1Resolutionnot fixable => fixed
2017-03-11 11:52Kunda1Fixed in Version => 0.17
2017-03-11 11:53Kunda1Tag Detached: #pending

Issue History

Date Modified Username Field Change
2016-04-14 22:13 fran6t New Issue
2016-04-14 22:13 fran6t File Added: Debug.FCStd
2017-01-09 23:39 Kunda1 Tag Attached: STEP
2017-01-10 10:19 wmayer Note Added: 0007595
2017-01-10 10:19 wmayer Status new => confirmed
2017-01-10 10:19 wmayer Resolution open => not fixable
2017-01-12 15:38 Kunda1 Tag Attached: OCC Bug
2017-01-12 15:38 Kunda1 Tag Attached: upstream
2017-01-12 15:40 Kunda1 Note Added: 0007673
2017-01-24 12:43 Kunda1 Tag Attached: #pending
2017-01-24 12:49 Kunda1 Summary Crash when export .step => Crash when export .step (due to an upstream OCC bug)
2017-01-24 12:53 Kunda1 Note Added: 0007958
2017-03-10 23:19 Kunda1 Note Added: 0008605
2017-03-11 04:47 normandc Note Added: 0008606
2017-03-11 11:52 Kunda1 Status confirmed => resolved
2017-03-11 11:52 Kunda1 Resolution not fixable => fixed
2017-03-11 11:52 Kunda1 Fixed in Version => 0.17
2017-03-11 11:52 Kunda1 Note Added: 0008611
2017-03-11 11:53 Kunda1 Tag Detached: #pending