[Bug] SIGSEGV on opening dxf file

Here's the place for discussion related to coding in FreeCAD, C++ or Python. Design, interfaces and structures.
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
User avatar
PrzemoF
Veteran
Posts: 3520
Joined: Fri Jul 25, 2014 4:52 pm
Contact:

[Bug] SIGSEGV on opening dxf file

Post by PrzemoF »

Code: Select all

$ FreeCAD
FreeCAD 0.21.0, Libs: 0.21.0Rpre_32806.fc36 (Git)
© Juergen Riegel, Werner Mayer, Yorik van Havre and others 2001-2023
FreeCAD is free and open-source software licensed under the terms of LGPL2+ license.
FreeCAD wouldn't be possible without FreeCAD community.
  #####                 ####  ###   ####  
  #                    #      # #   #   # 
  #     ##  #### ####  #     #   #  #   # 
  ####  # # #  # #  #  #     #####  #   # 
  #     #   #### ####  #    #     # #   # 
  #     #   #    #     #    #     # #   #  ##  ##  ##
  #     #   #### ####   ### #     # ####   ##  ##  ##

CDxfRead::ReadLayer() - no layer name
CDxfRead::DoRead() Failed to read layer
CDxfRead::ReadLayer() - no layer name
CDxfRead::DoRead() Failed to read layer
CDxfRead::ReadLayer() - no layer name
CDxfRead::DoRead() Failed to read layer
CDxfRead::ReadLayer() - no layer name
CDxfRead::DoRead() Failed to read layer
CDxfRead::ReadLayer() - no layer name
CDxfRead::DoRead() Failed to read layer
CDxfRead::ReadLayer() - no layer name
CDxfRead::DoRead() Failed to read layer
CDxfRead::ReadLayer() - no layer name
CDxfRead::DoRead() Failed to read layer
Program received signal SIGSEGV, Segmentation fault.
#0  /lib64/libc.so.6(+0x3ea00) [0x7f3825c3ea00]
#1  /lib64/libpython3.10.so.1.0(+0x11dd4b) [0x7f3827b1dd4b]
#2  0x7f376bbbd46e in CDxfRead::ReadText() from /usr/lib64/freecad/lib64/Import.so+0x652
#3  0x7f376bbc3792 in CDxfRead::DoRead(bool) from /usr/lib64/freecad/lib64/Import.so+0x4a8
#4  0x7f376bb47747 in Import::Module::readDXF(Py::Tuple const&) from /usr/lib64/freecad/lib64/Import.so+0x305
#5  0x7f376bb536a5 in Py::ExtensionModule<Import::Module>::invoke_method_varargs(void*, Py::Tuple const&) from /usr/lib64/freecad/lib64/Import.so+0x89
#6  /usr/lib64/freecad/lib64/libFreeCADBase.so(method_varargs_call_handler+0x11a) [0x7f3828083a38]
#7  /lib64/libpython3.10.so.1.0(+0x11dd98) [0x7f3827b1dd98]
#8  /lib64/libpython3.10.so.1.0(_PyObject_MakeTpCall+0x78) [0x7f3827b19dc8]
#9  /lib64/libpython3.10.so.1.0(_PyEval_EvalFrameDefault+0x6058) [0x7f3827b172e8]
#10  /lib64/libpython3.10.so.1.0(+0x1104f3) [0x7f3827b104f3]
#11  /lib64/libpython3.10.so.1.0(_PyEval_EvalFrameDefault+0x5493) [0x7f3827b16723]
#12  /lib64/libpython3.10.so.1.0(+0x1104f3) [0x7f3827b104f3]
#13  /lib64/libpython3.10.so.1.0(PyEval_EvalCode+0x94) [0x7f3827b8b2d4]
#14  /lib64/libpython3.10.so.1.0(+0x1bb763) [0x7f3827bbb763]
#15  /lib64/libpython3.10.so.1.0(+0x1b6a3a) [0x7f3827bb6a3a]
#16  /lib64/libpython3.10.so.1.0(PyRun_StringFlags+0x81) [0x7f3827baebc1]
#17  0x7f38280ee0e7 in Base::InterpreterSingleton::runString[abi:cxx11](char const*) from /usr/lib64/freecad/lib64/libFreeCADBase.so+0xd5
#18  0x7f382a9ba662 in Gui::Command::_runCommand(char const*, int, Gui::Command::DoCmd_Type, char const*) from /usr/lib64/freecad/lib64/libFreeCADGui.so+0xc6
#19  0x7f382a9ba333 in Gui::Command::_doCommand(char const*, int, Gui::Command::DoCmd_Type, char const*, ...) from /usr/lib64/freecad/lib64/libFreeCADGui.so+0xfd
#20  0x7f382a7e2093 in Gui::Application::open(char const*, char const*) from /usr/lib64/freecad/lib64/libFreeCADGui.so+0x45b
#21  0x7f382a9d4245 in StdCmdOpen::activated(int) from /usr/lib64/freecad/lib64/libFreeCADGui.so+0x885
#22  0x7f382a9b9262 in Gui::Command::_invoke(int, bool) from /usr/lib64/freecad/lib64/libFreeCADGui.so+0x262
#23  0x7f382a9b8fd2 in Gui::Command::invoke(int, Gui::Command::TriggerSource) from /usr/lib64/freecad/lib64/libFreeCADGui.so+0x12a
#24  0x7f382a9a3b58 in Gui::Action::onActivated() from /usr/lib64/freecad/lib64/libFreeCADGui.so+0x2a
#25  0x7f382a9b29fb in QtPrivate::FunctorCall<QtPrivate::IndexesList<>, QtPrivate::List<>, void, void (Gui::Action::*)()>::call(void (Gui::Action::*)(), Gui::Action*, void**) from /usr/lib64/freecad/lib64/libFreeCADGui.so+0x6b
#26  0x7f382a9b213d in void QtPrivate::FunctionPointer<void (Gui::Action::*)()>::call<QtPrivate::List<>, void>(void (Gui::Action::*)(), Gui::Action*, void**) from /usr/lib64/freecad/lib64/libFreeCADGui.so+0x42
#27  0x7f382a9b14c7 in QtPrivate::QSlotObject<void (Gui::Action::*)(), QtPrivate::List<>, void>::impl(int, QtPrivate::QSlotObjectBase*, QObject*, void**, bool*) from /usr/lib64/freecad/lib64/libFreeCADGui.so+0x80
#28  /lib64/libQt5Core.so.5(+0x2d0e96) [0x7f38266d0e96]
#29  0x7f38273a82f6 in QAction::triggered(bool) from /lib64/libQt5Widgets.so.5+0x46
#30  0x7f38273aafb3 in QAction::activate(QAction::ActionEvent) from /lib64/libQt5Widgets.so.5+0xb3
#31  /lib64/libQt5Widgets.so.5(+0x3350a2) [0x7f38275350a2]
#32  /lib64/libQt5Widgets.so.5(+0x33cf7c) [0x7f382753cf7c]
#33  0x7f38273f1938 in QWidget::event(QEvent*) from /lib64/libQt5Widgets.so.5+0x1b8
#34  0x7f38273aed62 in QApplicationPrivate::notify_helper(QObject*, QEvent*) from /lib64/libQt5Widgets.so.5+0x82
#35  0x7f38273b73d2 in QApplication::notify(QObject*, QEvent*) from /lib64/libQt5Widgets.so.5+0x13d2
#36  0x7f382a961ecd in Gui::GUIApplication::notify(QObject*, QEvent*) from /usr/lib64/freecad/lib64/libFreeCADGui.so+0xff
#37  0x7f382669d4e8 in QCoreApplication::notifyInternal2(QObject*, QEvent*) from /lib64/libQt5Core.so.5+0x118
#38  0x7f38273b54d2 in QApplicationPrivate::sendMouseEvent(QWidget*, QMouseEvent*, QWidget*, QWidget*, QWidget**, QPointer<QWidget>&, bool, bool) from /lib64/libQt5Widgets.so.5+0x1c2
#39  /lib64/libQt5Widgets.so.5(+0x20b0f5) [0x7f382740b0f5]
#40  /lib64/libQt5Widgets.so.5(+0x20e060) [0x7f382740e060]
#41  0x7f38273aed62 in QApplicationPrivate::notify_helper(QObject*, QEvent*) from /lib64/libQt5Widgets.so.5+0x82
#42  0x7f382a961ecd in Gui::GUIApplication::notify(QObject*, QEvent*) from /usr/lib64/freecad/lib64/libFreeCADGui.so+0xff
#43  0x7f382669d4e8 in QCoreApplication::notifyInternal2(QObject*, QEvent*) from /lib64/libQt5Core.so.5+0x118
#44  0x7f3826b6ad6d in QGuiApplicationPrivate::processMouseEvent(QWindowSystemInterfacePrivate::MouseEvent*) from /lib64/libQt5Gui.so.5+0x86d
#45  0x7f3826b49f1c in QWindowSystemInterface::sendWindowSystemEvents(QFlags<QEventLoop::ProcessEventsFlag>) from /lib64/libQt5Gui.so.5+0xac
#46  /lib64/libQt5XcbQpa.so.5(+0x6f90e) [0x7f3813ecd90e]
#47  /lib64/libglib-2.0.so.0(g_main_context_dispatch+0x19f) [0x7f3824726faf]
#48  /lib64/libglib-2.0.so.0(+0xaa2c8) [0x7f382477c2c8]
#49  /lib64/libglib-2.0.so.0(g_main_context_iteration+0x30) [0x7f3824724940]
#50  0x7f38266ee5fa in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) from /lib64/libQt5Core.so.5+0x6a
#51  0x7f382669bf3a in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) from /lib64/libQt5Core.so.5+0x13a
#52  0x7f38266a4002 in QCoreApplication::exec() from /lib64/libQt5Core.so.5+0x92
#53  0x7f382a7ec57d in Gui::Application::runApplication() from /usr/lib64/freecad/lib64/libFreeCADGui.so+0x28dd
#54  FreeCAD() [0x4295cb]
#55  /lib64/libc.so.6(+0x29510) [0x7f3825c29510]
#56  /lib64/libc.so.6(__libc_start_main+0x89) [0x7f3825c295c9]
#57  FreeCAD() [0x4287f5]

Code: Select all

OS: Fedora Linux 36 (Workstation Edition) (GNOME/gnome)
Word size of FreeCAD: 64-bit
Version: 0.21.0.pre_32806.fc36 (Git)
Build type: Unknown
Python 3.10.10, Qt 5.15.8, Coin 4.0.0, Vtk 9.1.0, OCC 7.6.3
Locale: English/United States (en_US)
Installed mods: 
  * BIM 2021.12.0
On online viewer handles the file fine: https://products.groupdocs.app/viewer/dxf
Attachments
ConsultaMasiva_.dxf
(6.33 KiB) Downloaded 29 times
User avatar
PrzemoF
Veteran
Posts: 3520
Joined: Fri Jul 25, 2014 4:52 pm
Contact:

Re: [Bug] SIGSEGV on opening dxf file

Post by PrzemoF »

Looks like having 2 nodes like this triggers the problem:

Code: Select all

TEXT
  8
txtConstru
 10
386265.74
 20
4565205.95
 40
2.0
 50
0.0
  1
-I+I+ALT
 72
1
 73
1
 11
386265.74
 21
4565205.95
  0
POLYLINE
  8
Construccion
 66
1
  0

wmayer
Founder
Posts: 20308
Joined: Thu Feb 19, 2009 10:32 am
Contact:

Re: [Bug] SIGSEGV on opening dxf file

Post by wmayer »

SIGSEGV on opening dxf file
Confirmed. The crash happens inside dxf.cpp at the line:

Code: Select all

const char* utfStr = (this->*stringToUTF8)(m_str);
The member variable stringToUTF8 is a function pointer and not initialized. Hence the crash.
wmayer
Founder
Posts: 20308
Joined: Thu Feb 19, 2009 10:32 am
Contact:

Re: [Bug] SIGSEGV on opening dxf file

Post by wmayer »

User avatar
PrzemoF
Veteran
Posts: 3520
Joined: Fri Jul 25, 2014 4:52 pm
Contact:

Re: [Bug] SIGSEGV on opening dxf file

Post by PrzemoF »

TGV/AVE/Shinkansen speed - thank you! :o
I'll test it as after the nightly build and report back.
openBrain
Veteran
Posts: 9041
Joined: Fri Nov 09, 2018 5:38 pm
Contact:

Re: [Bug] SIGSEGV on opening dxf file

Post by openBrain »

PrzemoF wrote: Sat Apr 29, 2023 6:15 pm TGV/AVE/Shinkansen speed
You're probably missing the most appropriate in case of wmayer : ICE :D
User avatar
PrzemoF
Veteran
Posts: 3520
Joined: Fri Jul 25, 2014 4:52 pm
Contact:

Re: [Bug] SIGSEGV on opening dxf file

Post by PrzemoF »

Yes, he's the ICE contact for FreeCAD :D
wmayer
Founder
Posts: 20308
Joined: Thu Feb 19, 2009 10:32 am
Contact:

Re: [Bug] SIGSEGV on opening dxf file

Post by wmayer »

openBrain wrote: Sat Apr 29, 2023 7:45 pm
PrzemoF wrote: Sat Apr 29, 2023 6:15 pm TGV/AVE/Shinkansen speed
You're probably missing the most appropriate in case of wmayer : ICE :D
It's fast if it works.
User avatar
PrzemoF
Veteran
Posts: 3520
Joined: Fri Jul 25, 2014 4:52 pm
Contact:

Re: [Bug] SIGSEGV on opening dxf file

Post by PrzemoF »

Looks like it's not it or not only it.

Code: Select all

Program received signal SIGSEGV, Segmentation fault.
#0  /lib64/libc.so.6(+0x3ea00) [0x7f2c28a3ea00]
#1  /lib64/libpython3.10.so.1.0(+0x11dd4b) [0x7f2c2a91dd4b]
#2  0x7f2b6e1bd46e in CDxfRead::ReadText() from /usr/lib64/freecad/lib64/Import.so+0x652
#3  0x7f2b6e1c3792 in CDxfRead::DoRead(bool) from /usr/lib64/freecad/lib64/Import.so+0x4a8
#4  0x7f2b6e147747 in Import::Module::readDXF(Py::Tuple const&) from /usr/lib64/freecad/lib64/Import.so+0x305
#5  0x7f2b6e1536a5 in Py::ExtensionModule<Import::Module>::invoke_method_varargs(void*, Py::Tuple const&) from /usr/lib64/freecad/lib64/Import.so+0x89
#6  /usr/lib64/freecad/lib64/libFreeCADBase.so(method_varargs_call_handler+0x11a) [0x7f2c2ae83a38]
#7  /lib64/libpython3.10.so.1.0(+0x11dd98) [0x7f2c2a91dd98]
#8  /lib64/libpython3.10.so.1.0(_PyObject_MakeTpCall+0x78) [0x7f2c2a919dc8]
#9  /lib64/libpython3.10.so.1.0(_PyEval_EvalFrameDefault+0x6058) [0x7f2c2a9172e8]
#10  /lib64/libpython3.10.so.1.0(+0x1104f3) [0x7f2c2a9104f3]
#11  /lib64/libpython3.10.so.1.0(_PyEval_EvalFrameDefault+0x5493) [0x7f2c2a916723]
#12  /lib64/libpython3.10.so.1.0(+0x1104f3) [0x7f2c2a9104f3]
#13  /lib64/libpython3.10.so.1.0(PyEval_EvalCode+0x94) [0x7f2c2a98b2d4]
#14  /lib64/libpython3.10.so.1.0(+0x1bb763) [0x7f2c2a9bb763]
#15  /lib64/libpython3.10.so.1.0(+0x1b6a3a) [0x7f2c2a9b6a3a]
#16  /lib64/libpython3.10.so.1.0(PyRun_StringFlags+0x81) [0x7f2c2a9aebc1]
#17  0x7f2c2aeee0e7 in Base::InterpreterSingleton::runString[abi:cxx11](char const*) from /usr/lib64/freecad/lib64/libFreeCADBase.so+0xd5
#18  0x7f2c2d7ba662 in Gui::Command::_runCommand(char const*, int, Gui::Command::DoCmd_Type, char const*) from /usr/lib64/freecad/lib64/libFreeCADGui.so+0xc6
#19  0x7f2c2d7ba333 in Gui::Command::_doCommand(char const*, int, Gui::Command::DoCmd_Type, char const*, ...) from /usr/lib64/freecad/lib64/libFreeCADGui.so+0xfd
#20  0x7f2c2d5e27c5 in Gui::Application::importFrom(char const*, char const*, char const*) from /usr/lib64/freecad/lib64/libFreeCADGui.so+0x2d1
#21  0x7f2c2d7d4e1d in StdCmdImport::activated(int) from /usr/lib64/freecad/lib64/libFreeCADGui.so+0x713
#22  0x7f2c2d7b9262 in Gui::Command::_invoke(int, bool) from /usr/lib64/freecad/lib64/libFreeCADGui.so+0x262
#23  0x7f2c2d7b8fd2 in Gui::Command::invoke(int, Gui::Command::TriggerSource) from /usr/lib64/freecad/lib64/libFreeCADGui.so+0x12a
#24  0x7f2c2d7a3b58 in Gui::Action::onActivated() from /usr/lib64/freecad/lib64/libFreeCADGui.so+0x2a
#25  0x7f2c2d7b29fb in QtPrivate::FunctorCall<QtPrivate::IndexesList<>, QtPrivate::List<>, void, void (Gui::Action::*)()>::call(void (Gui::Action::*)(), Gui::Action*, void**) from /usr/lib64/freecad/lib64/libFreeCADGui.so+0x6b
#26  0x7f2c2d7b213d in void QtPrivate::FunctionPointer<void (Gui::Action::*)()>::call<QtPrivate::List<>, void>(void (Gui::Action::*)(), Gui::Action*, void**) from /usr/lib64/freecad/lib64/libFreeCADGui.so+0x42
#27  0x7f2c2d7b14c7 in QtPrivate::QSlotObject<void (Gui::Action::*)(), QtPrivate::List<>, void>::impl(int, QtPrivate::QSlotObjectBase*, QObject*, void**, bool*) from /usr/lib64/freecad/lib64/libFreeCADGui.so+0x80
#28  /lib64/libQt5Core.so.5(+0x2d0e96) [0x7f2c294d0e96]
#29  0x7f2c2a1a82f6 in QAction::triggered(bool) from /lib64/libQt5Widgets.so.5+0x46
#30  0x7f2c2a1aafb3 in QAction::activate(QAction::ActionEvent) from /lib64/libQt5Widgets.so.5+0xb3
#31  /lib64/libQt5Widgets.so.5(+0x3350a2) [0x7f2c2a3350a2]
#32  /lib64/libQt5Widgets.so.5(+0x33cf7c) [0x7f2c2a33cf7c]
#33  0x7f2c2a1f1938 in QWidget::event(QEvent*) from /lib64/libQt5Widgets.so.5+0x1b8
#34  0x7f2c2a1aed62 in QApplicationPrivate::notify_helper(QObject*, QEvent*) from /lib64/libQt5Widgets.so.5+0x82
#35  0x7f2c2a1b73d2 in QApplication::notify(QObject*, QEvent*) from /lib64/libQt5Widgets.so.5+0x13d2
#36  0x7f2c2d761ecd in Gui::GUIApplication::notify(QObject*, QEvent*) from /usr/lib64/freecad/lib64/libFreeCADGui.so+0xff
#37  0x7f2c2949d4e8 in QCoreApplication::notifyInternal2(QObject*, QEvent*) from /lib64/libQt5Core.so.5+0x118
#38  0x7f2c2a1b54d2 in QApplicationPrivate::sendMouseEvent(QWidget*, QMouseEvent*, QWidget*, QWidget*, QWidget**, QPointer<QWidget>&, bool, bool) from /lib64/libQt5Widgets.so.5+0x1c2
#39  /lib64/libQt5Widgets.so.5(+0x20b0f5) [0x7f2c2a20b0f5]
#40  /lib64/libQt5Widgets.so.5(+0x20e060) [0x7f2c2a20e060]
#41  0x7f2c2a1aed62 in QApplicationPrivate::notify_helper(QObject*, QEvent*) from /lib64/libQt5Widgets.so.5+0x82
#42  0x7f2c2d761ecd in Gui::GUIApplication::notify(QObject*, QEvent*) from /usr/lib64/freecad/lib64/libFreeCADGui.so+0xff
#43  0x7f2c2949d4e8 in QCoreApplication::notifyInternal2(QObject*, QEvent*) from /lib64/libQt5Core.so.5+0x118
#44  0x7f2c2996ad6d in QGuiApplicationPrivate::processMouseEvent(QWindowSystemInterfacePrivate::MouseEvent*) from /lib64/libQt5Gui.so.5+0x86d
#45  0x7f2c29949f1c in QWindowSystemInterface::sendWindowSystemEvents(QFlags<QEventLoop::ProcessEventsFlag>) from /lib64/libQt5Gui.so.5+0xac
#46  /lib64/libQt5XcbQpa.so.5(+0x6f90e) [0x7f2c16ea790e]
#47  /lib64/libglib-2.0.so.0(g_main_context_dispatch+0x19f) [0x7f2c27718faf]
#48  /lib64/libglib-2.0.so.0(+0xaa2c8) [0x7f2c2776e2c8]
#49  /lib64/libglib-2.0.so.0(g_main_context_iteration+0x30) [0x7f2c27716940]
#50  0x7f2c294ee5fa in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) from /lib64/libQt5Core.so.5+0x6a
#51  0x7f2c2949bf3a in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) from /lib64/libQt5Core.so.5+0x13a
#52  0x7f2c294a4002 in QCoreApplication::exec() from /lib64/libQt5Core.so.5+0x92
#53  0x7f2c2d5ec57d in Gui::Application::runApplication() from /usr/lib64/freecad/lib64/libFreeCADGui.so+0x28dd
#54  FreeCAD() [0x4295cb]
#55  /lib64/libc.so.6(+0x29510) [0x7f2c28a29510]
#56  /lib64/libc.so.6(__libc_start_main+0x89) [0x7f2c28a295c9]
#57  FreeCAD() [0x4287f5]

Code: Select all

OS: Fedora Linux 36 (Workstation Edition) (GNOME/gnome)
Word size of FreeCAD: 64-bit
Version: 0.21.0.pre_32806.fc36 (Git)
Build type: Unknown
Python 3.10.10, Qt 5.15.8, Coin 4.0.0, Vtk 9.1.0, OCC 7.6.3
Locale: English/United States (en_US)
Installed mods: 
  * BIM 2021.12.0
  * MeshRemodel 1.8919.0
Post Reply