Archived issue #0030224
StlAPI_Writer crashes on STEP converted file
Description
While saving the shape read from an attached STEP file (and only for that specific one), my simple app crashes.
Debug infos:
backtrace:
#0 0x00007ffff730443c in NCollection_Array1<gp_Pnt>::Lower (this=0x18) at [user path removed]/Downloads/opencascade-7.3.0/src/NCollection/NCollection_Array1.hxx:264
No locals.
#0000001 0x00007ffff6d75e23 in StlAPI_Writer::Write (this=0x7fffffffd23f, theShape=..., theFileName=0x697500 "CO3DP0000327177_I3-PS-02_25025_86cm3.stl") at [user path removed]/Downloads/opencascade-7.3.0/src/StlAPI/StlAPI_Writer.cxx:75
aNodeIter = 63
aTriangulation = {entity = 0x0}
aNodes = <error reading variable>
aTriangles = <error reading variable>
anOrientation = TopAbs_FORWARD
aLoc = {myItems = {myNode = {entity = 0x0}}}
aTrsf = {scale = 1, shape = gp_Identity, matrix = {matrix = {{1, 0, 0}, {0, 1, 0}, {0, 0, 1}}}, loc = {x = 0, y = 0, z = 0}}
anExpSF = {myStack = 0x5d2f250, myTop = 2, mySizeOfStack = 20, myShape = {myTShape = {entity = 0x71d9e0}, myLocation = {myItems = {myNode = {entity = 0x0}}}, myOrient = TopAbs_FORWARD}, hasMore = true, toFind = TopAbs_FACE, toAvoid = TopAbs_SHAPE}
aNbNodes = 837714
aNbTriangles = 1419950
aMesh = {entity = 0x568c0d0}
aNodeOffset = 281654
aTriangleOffet = 490093
aPath = {myNode = {mystring = 0x7fffffffd130 "H\257\274\232\362\327z>\001\001", mylength = -11680}, myUserName = {mystring = 0x3fe0000000000000 <error: Cannot access memory at address 0x3fe0000000000000>, mylength = -1917273401}, myPassword = {mystring = 0x3e7ad7f29abcaf48 <error: Cannot access memory at address 0x3e7ad7f29abcaf48>, mylength = 16777473}, myDisk = {mystring = 0x7ffff7d25238 <vtable for Standard_Transient+16> "\370\223\244\367\377\177", mylength = 0}, myTrek = {mystring = 0x0, mylength = 0}, myName = {mystring = 0x7fff00000000 <error: Cannot access memory at address 0x7fff00000000>, mylength = -12031}, myExtension = {mystring = 0x7ffff7d24b28 <vtable for NCollection_BaseMap+16> "\270\231\246\367\377\177", mylength = 0}, myUNCFlag = false, mySysDep = OSD_Unknown}
#0000002 0x00007ffff6d728c7 in StlAPI::Write (theShape=..., theFile=0x697500 "CO3DP0000327177_I3-PS-02_25025_86cm3.stl", theAsciiMode=false) at [user path removed]/Downloads/opencascade-7.3.0/src/StlAPI/StlAPI.cxx:30
aWriter = {myASCIIMode = false}
#3 0x000000000043af32 in step2stl (in="CO3DP0000327177_I3-PS-02_25025_86cm3.stp", out="CO3DP0000327177_I3-PS-02_25025_86cm3.stl") at [user path removed]/Documents/Projects/step2stl/src/lib/converter.cpp:15
model = {shape = {myTShape = {entity = 0x71d9e0}, myLocation = {myItems = {myNode = {entity = 0x0}}}, myOrient = TopAbs_FORWARD}}
#4 0x000000000043ae0d in main (argc=3, argv=0x7fffffffd478) at [user path removed]/Documents/Projects/step2stl/src/main.cpp:5
No locals.
registers:
rax 0x18 24
rbx 0x0 0
rcx 0x0 0
rdx 0x0 0
rsi 0x1a91398 27857816
rdi 0x18 24
rbp 0x7fffffffd390 0x7fffffffd390
rsp 0x7fffffffd310 0x7fffffffd310
r8 0x5d2f250 97710672
r9 0x232 562
r10 0x0 0
r11 0x7ffff6d766a4 140737334699684
r12 0x43acb0 4435120
r13 0x7fffffffd470 140737488344176
r14 0x0 0
r15 0x0 0
rip 0x43ae0d 0x43ae0d <main(int, char const**)+119>
eflags 0x10202 [ IF RF ]
cs 0x33 51
ss 0x2b 43
ds 0x0 0
es 0x0 0
fs 0x0 0
gs 0x0 0
current instructions:
=> 0x43ae0d <main(int, char const**)+119>: mov ebx,eax
0x43ae0f <main(int, char const**)+121>: nop
0x43ae10 <main(int, char const**)+122>: lea rax,[rbp-0x40]
0x43ae14 <main(int, char const**)+126>: mov rdi,rax
0x43ae17 <main(int, char const**)+129>: call 0x43a8c0 <_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED1Ev@plt>
0x43ae1c <main(int, char const**)+134>: lea rax,[rbp-0x11]
0x43ae20 <main(int, char const**)+138>: mov rdi,rax
0x43ae23 <main(int, char const**)+141>: call 0x43aca0 <_ZNSaIcED1Ev@plt>
0x43ae28 <main(int, char const**)+146>: lea rax,[rbp-0x70]
0x43ae2c <main(int, char const**)+150>: mov rdi,rax
0x43ae2f <main(int, char const**)+153>: call 0x43a8c0 <_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED1Ev@plt>
0x43ae34 <main(int, char const**)+158>: lea rax,[rbp-0x41]
0x43ae38 <main(int, char const**)+162>: mov rdi,rax
0x43ae3b <main(int, char const**)+165>: call 0x43aca0 <_ZNSaIcED1Ev@plt>
0x43ae40 <main(int, char const**)+170>: mov eax,ebx
0x43ae42 <main(int, char const**)+172>: jmp 0x43ae8c <main(int, char const**)+246>
threads backtrace:
Thread 1 (Thread 0x7ffff7fcd740 (LWP 20508)):
#0 0x00007ffff730443c in NCollection_Array1<gp_Pnt>::Lower (this=0x18) at [user path removed]/Downloads/opencascade-7.3.0/src/NCollection/NCollection_Array1.hxx:264
#0000001 0x00007ffff6d75e23 in StlAPI_Writer::Write (this=0x7fffffffd23f, theShape=..., theFileName=0x697500 "CO3DP0000327177_I3-PS-02_25025_86cm3.stl") at [user path removed]/Downloads/opencascade-7.3.0/src/StlAPI/StlAPI_Writer.cxx:75
#0000002 0x00007ffff6d728c7 in StlAPI::Write (theShape=..., theFile=0x697500 "CO3DP0000327177_I3-PS-02_25025_86cm3.stl", theAsciiMode=false) at [user path removed]/Downloads/opencascade-7.3.0/src/StlAPI/StlAPI.cxx:30
#3 0x000000000043af32 in step2stl (in="CO3DP0000327177_I3-PS-02_25025_86cm3.stp", out="CO3DP0000327177_I3-PS-02_25025_86cm3.stl") at [user path removed]/Documents/Projects/step2stl/src/lib/converter.cpp:15
#4 0x000000000043ae0d in main (argc=3, argv=0x7fffffffd478) at [user path removed]/Documents/Projects/step2stl/src/main.cpp:5
Debug infos:
backtrace:
#0 0x00007ffff730443c in NCollection_Array1<gp_Pnt>::Lower (this=0x18) at [user path removed]/Downloads/opencascade-7.3.0/src/NCollection/NCollection_Array1.hxx:264
No locals.
#0000001 0x00007ffff6d75e23 in StlAPI_Writer::Write (this=0x7fffffffd23f, theShape=..., theFileName=0x697500 "CO3DP0000327177_I3-PS-02_25025_86cm3.stl") at [user path removed]/Downloads/opencascade-7.3.0/src/StlAPI/StlAPI_Writer.cxx:75
aNodeIter = 63
aTriangulation = {entity = 0x0}
aNodes = <error reading variable>
aTriangles = <error reading variable>
anOrientation = TopAbs_FORWARD
aLoc = {myItems = {myNode = {entity = 0x0}}}
aTrsf = {scale = 1, shape = gp_Identity, matrix = {matrix = {{1, 0, 0}, {0, 1, 0}, {0, 0, 1}}}, loc = {x = 0, y = 0, z = 0}}
anExpSF = {myStack = 0x5d2f250, myTop = 2, mySizeOfStack = 20, myShape = {myTShape = {entity = 0x71d9e0}, myLocation = {myItems = {myNode = {entity = 0x0}}}, myOrient = TopAbs_FORWARD}, hasMore = true, toFind = TopAbs_FACE, toAvoid = TopAbs_SHAPE}
aNbNodes = 837714
aNbTriangles = 1419950
aMesh = {entity = 0x568c0d0}
aNodeOffset = 281654
aTriangleOffet = 490093
aPath = {myNode = {mystring = 0x7fffffffd130 "H\257\274\232\362\327z>\001\001", mylength = -11680}, myUserName = {mystring = 0x3fe0000000000000 <error: Cannot access memory at address 0x3fe0000000000000>, mylength = -1917273401}, myPassword = {mystring = 0x3e7ad7f29abcaf48 <error: Cannot access memory at address 0x3e7ad7f29abcaf48>, mylength = 16777473}, myDisk = {mystring = 0x7ffff7d25238 <vtable for Standard_Transient+16> "\370\223\244\367\377\177", mylength = 0}, myTrek = {mystring = 0x0, mylength = 0}, myName = {mystring = 0x7fff00000000 <error: Cannot access memory at address 0x7fff00000000>, mylength = -12031}, myExtension = {mystring = 0x7ffff7d24b28 <vtable for NCollection_BaseMap+16> "\270\231\246\367\377\177", mylength = 0}, myUNCFlag = false, mySysDep = OSD_Unknown}
#0000002 0x00007ffff6d728c7 in StlAPI::Write (theShape=..., theFile=0x697500 "CO3DP0000327177_I3-PS-02_25025_86cm3.stl", theAsciiMode=false) at [user path removed]/Downloads/opencascade-7.3.0/src/StlAPI/StlAPI.cxx:30
aWriter = {myASCIIMode = false}
#3 0x000000000043af32 in step2stl (in="CO3DP0000327177_I3-PS-02_25025_86cm3.stp", out="CO3DP0000327177_I3-PS-02_25025_86cm3.stl") at [user path removed]/Documents/Projects/step2stl/src/lib/converter.cpp:15
model = {shape = {myTShape = {entity = 0x71d9e0}, myLocation = {myItems = {myNode = {entity = 0x0}}}, myOrient = TopAbs_FORWARD}}
#4 0x000000000043ae0d in main (argc=3, argv=0x7fffffffd478) at [user path removed]/Documents/Projects/step2stl/src/main.cpp:5
No locals.
registers:
rax 0x18 24
rbx 0x0 0
rcx 0x0 0
rdx 0x0 0
rsi 0x1a91398 27857816
rdi 0x18 24
rbp 0x7fffffffd390 0x7fffffffd390
rsp 0x7fffffffd310 0x7fffffffd310
r8 0x5d2f250 97710672
r9 0x232 562
r10 0x0 0
r11 0x7ffff6d766a4 140737334699684
r12 0x43acb0 4435120
r13 0x7fffffffd470 140737488344176
r14 0x0 0
r15 0x0 0
rip 0x43ae0d 0x43ae0d <main(int, char const**)+119>
eflags 0x10202 [ IF RF ]
cs 0x33 51
ss 0x2b 43
ds 0x0 0
es 0x0 0
fs 0x0 0
gs 0x0 0
current instructions:
=> 0x43ae0d <main(int, char const**)+119>: mov ebx,eax
0x43ae0f <main(int, char const**)+121>: nop
0x43ae10 <main(int, char const**)+122>: lea rax,[rbp-0x40]
0x43ae14 <main(int, char const**)+126>: mov rdi,rax
0x43ae17 <main(int, char const**)+129>: call 0x43a8c0 <_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED1Ev@plt>
0x43ae1c <main(int, char const**)+134>: lea rax,[rbp-0x11]
0x43ae20 <main(int, char const**)+138>: mov rdi,rax
0x43ae23 <main(int, char const**)+141>: call 0x43aca0 <_ZNSaIcED1Ev@plt>
0x43ae28 <main(int, char const**)+146>: lea rax,[rbp-0x70]
0x43ae2c <main(int, char const**)+150>: mov rdi,rax
0x43ae2f <main(int, char const**)+153>: call 0x43a8c0 <_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED1Ev@plt>
0x43ae34 <main(int, char const**)+158>: lea rax,[rbp-0x41]
0x43ae38 <main(int, char const**)+162>: mov rdi,rax
0x43ae3b <main(int, char const**)+165>: call 0x43aca0 <_ZNSaIcED1Ev@plt>
0x43ae40 <main(int, char const**)+170>: mov eax,ebx
0x43ae42 <main(int, char const**)+172>: jmp 0x43ae8c <main(int, char const**)+246>
threads backtrace:
Thread 1 (Thread 0x7ffff7fcd740 (LWP 20508)):
#0 0x00007ffff730443c in NCollection_Array1<gp_Pnt>::Lower (this=0x18) at [user path removed]/Downloads/opencascade-7.3.0/src/NCollection/NCollection_Array1.hxx:264
#0000001 0x00007ffff6d75e23 in StlAPI_Writer::Write (this=0x7fffffffd23f, theShape=..., theFileName=0x697500 "CO3DP0000327177_I3-PS-02_25025_86cm3.stl") at [user path removed]/Downloads/opencascade-7.3.0/src/StlAPI/StlAPI_Writer.cxx:75
#0000002 0x00007ffff6d728c7 in StlAPI::Write (theShape=..., theFile=0x697500 "CO3DP0000327177_I3-PS-02_25025_86cm3.stl", theAsciiMode=false) at [user path removed]/Downloads/opencascade-7.3.0/src/StlAPI/StlAPI.cxx:30
#3 0x000000000043af32 in step2stl (in="CO3DP0000327177_I3-PS-02_25025_86cm3.stp", out="CO3DP0000327177_I3-PS-02_25025_86cm3.stl") at [user path removed]/Documents/Projects/step2stl/src/lib/converter.cpp:15
#4 0x000000000043ae0d in main (argc=3, argv=0x7fffffffd478) at [user path removed]/Documents/Projects/step2stl/src/main.cpp:5
Steps to reproduce
Read the file using STEPControl_Reader, transfer roots, get one shape from it and try to save it using StlAPI::Write (theAsciiMode=Standard_False).
Public activity
2 archived notes
Participants are labeled by their role within this record.
It seems that StlApi_Writer.cpp just lacks the null check in the 73 line as it is in the previous loop on the shape. So simply adding "if (! aTriangulation.IsNull())" does it's job.
Please close as duplicate of already fixed #0030389.
Related records