LibreCAD / LibreCAD

LibreCAD is a cross-platform 2D CAD program written in C++17. It can read DXF/DWG files and can write DXF/PDF/SVG files. It supports point/line/circle/ellipse/parabola/spline primitives. The user interface is highly customizable, and has dozens of translations.
http://librecad.org/
Other
4.48k stars 1.01k forks source link

libdxfrw: crash in DRW_Header::parseCode #948

Closed bansan85 closed 1 year ago

bansan85 commented 6 years ago

LibreCad crashes while loading a empty draw.

Input: see enclosed file.

Output: Program received signal SIGSEGV, Segmentation fault. 0x00005555556480bc in DRW_Variant::addString (s="", c=1, this=0x0) at libraries/libdxfrw/src/drw_base.h:234 234 void addString(int c, UTF8STRING s) {vType = STRING; sdata = s; content.s = &sdata; vCode=c;} (gdb) bt

0 0x00005555556480bc in DRW_Variant::addString (s="", c=1, this=0x0)

at libraries/libdxfrw/src/drw_base.h:234

1 DRW_Header::parseCode (this=this@entry=0x7fffffffd568,

code=<optimized out>, reader=0x555555aa4130)
at libraries/libdxfrw/src/drw_header.cpp:41

2 0x00005555556bc7f2 in dxfRW::processHeader (this=this@entry=0x7fffffffd500)

at libraries/libdxfrw/src/libdxfrw.cpp:1878

3 0x000055555571bd28 in dxfRW::processDxf (this=this@entry=0x7fffffffd500)

at libraries/libdxfrw/src/libdxfrw.cpp:1842

4 0x000055555571ce94 in dxfRW::read (this=0x7fffffffd500,

interface_=<optimized out>, ext=<optimized out>)
at libraries/libdxfrw/src/libdxfrw.cpp:99

crash-header-parsecode.zip

fa201 commented 1 year ago

On last version, there is no crash but an error message and the file is not open. This seems satisfying to me.

Version: 2.2.0.2 Compiler: GNU GCC 9.4.0 Compiled on: Jul 29 2023 Qt Version: 5.12.9 Boost Version: 1.75.0 System: Ubuntu 20.04.6 LTS