GerbView crashes while loading Gerber file

Bug #1796744 reported by Nabeel Ahmad
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
KiCad
Fix Released
Medium
jean-pierre charras

Bug Description

GerbView crashes while loading one particular Gerber file, which is attached. This file has been obtained from the "PCB fabrication data - Example 1.zip" archive on Ucamco's Gerber downloads page [1].

Hundreds of failed assertions are reported by the program. The following detail was seen with GDB:
warning: D:/private-local/working/kicad/kicad/gerbview/am_primitive.cpp(70): assert "params.size() && params[0].IsImmediate()" failed in IsAMPrimitiveExposureOn().

If all these assert messages are ignored, the program finally crashes with the following detail:
Thread 1 received signal SIGSEGV, Segmentation fault.
0x0000000008960304 in KIGFX::VERTEX_MANAGER::ChangeItemDepth (
    this=0x248347f0, aItem=..., aDepth=129)
    at D:/private-local/working/kicad/kicad/common/gal/opengl/vertex_manager.cpp:204
204 vertex->z = aDepth;

A backtrace of the crash has been obtained using GDB and is copied below at [2].

------------------------------------------------------------------------------------

[1] https://www.ucamco.com/en/file-formats/gerber/downloads

[2] Backtrace:
#0 0x0000000008960304 in KIGFX::VERTEX_MANAGER::ChangeItemDepth (
    this=0x248347f0, aItem=..., aDepth=129)
    at D:/private-local/working/kicad/kicad/common/gal/opengl/vertex_manager.cpp:204
#1 0x000000000895b33d in KIGFX::OPENGL_GAL::ChangeGroupDepth (
    this=0x248d20f0, aGroupNumber=0, aDepth=129)
    at D:/private-local/working/kicad/kicad/common/gal/opengl/opengl_gal.cpp:1455
#2 0x00000000088dc78c in KIGFX::VIEW::UpdateAllLayersOrder (this=0x247624c0)
    at D:/private-local/working/kicad/kicad/common/view/view.cpp:929
#3 0x00000000088680c3 in GERBVIEW_DRAW_PANEL_GAL::SetTopLayer (
    this=0x22f39b20, aLayer=163)
    at D:/private-local/working/kicad/kicad/gerbview/gerbview_draw_panel_gal.cpp:175
#4 0x0000000008867c02 in GERBVIEW_DRAW_PANEL_GAL::SetHighContrastLayer (
    this=0x22f39b20, aLayer=163)
    at D:/private-local/working/kicad/kicad/gerbview/gerbview_draw_panel_gal.cpp:82
#5 0x000000000884a93a in GERBVIEW_FRAME::SetActiveLayer (this=0x22f2dac0,
    aLayer=1, doLayerWidgetUpdate=true)
    at D:/private-local/working/kicad/kicad/gerbview/gerbview_frame.cpp:949
#6 0x000000000884295f in GERBVIEW_FRAME::loadListOfGerberFiles (
    this=0x22f2dac0, aPath=..., aFilenameList=...)
    at D:/private-local/working/kicad/kicad/gerbview/files.cpp:323
#7 0x0000000008841ddb in GERBVIEW_FRAME::LoadGerberFiles (this=0x22f2dac0,
    aFullFileName=...)
    at D:/private-local/working/kicad/kicad/gerbview/files.cpp:222
#8 0x0000000008840bc5 in GERBVIEW_FRAME::OnGbrFileHistory (this=0x22f2dac0,
    event=...) at D:/private-local/working/kicad/kicad/gerbview/files.cpp:61
#9 0x000000006a4c2f24 in ?? ()
   from C:\msys64\mingw64\bin\wxbase30u_gcc_custom.dll
#10 0x000000006a62cd42 in ?? ()
   from C:\msys64\mingw64\bin\wxbase30u_gcc_custom.dll
#11 0x000000006a62ce48 in ?? ()
   from C:\msys64\mingw64\bin\wxbase30u_gcc_custom.dll
#12 0x000000006a62d254 in ?? ()
   from C:\msys64\mingw64\bin\wxbase30u_gcc_custom.dll
#13 0x00000000088b29f9 in EDA_BASE_FRAME::ProcessEvent (this=0x22f2dac0,
    aEvent=...)
    at D:/private-local/working/kicad/kicad/common/eda_base_frame.cpp:173
#14 0x000000006a62d003 in ?? ()
   from C:\msys64\mingw64\bin\wxbase30u_gcc_custom.dll
#15 0x000000006a62d321 in ?? ()
   from C:\msys64\mingw64\bin\wxbase30u_gcc_custom.dll
#16 0x00000000064b449f in ?? ()
   from C:\msys64\mingw64\bin\wxmsw30u_core_gcc_custom.dll
#17 0x000000006a62d05b in ?? ()
   from C:\msys64\mingw64\bin\wxbase30u_gcc_custom.dll
#18 0x0000000006461f8d in ?? ()
   from C:\msys64\mingw64\bin\wxmsw30u_core_gcc_custom.dll
#19 0x00000000062fea70 in ?? ()
   from C:\msys64\mingw64\bin\wxmsw30u_core_gcc_custom.dll
#20 0x00007ffc4f44b85d in USER32!CallWindowProcW ()
   from C:\Windows\System32\user32.dll
#21 0x00007ffc4f44b1ef in USER32!DispatchMessageW ()
   from C:\Windows\System32\user32.dll
#22 0x00000000062f5e8b in ?? ()
   from C:\msys64\mingw64\bin\wxmsw30u_core_gcc_custom.dll
#23 0x000000006a4fc6d0 in ?? ()
   from C:\msys64\mingw64\bin\wxbase30u_gcc_custom.dll
#24 0x000000006a4fc339 in ?? ()
   from C:\msys64\mingw64\bin\wxbase30u_gcc_custom.dll
#25 0x000000006a4c68fa in ?? ()
   from C:\msys64\mingw64\bin\wxbase30u_gcc_custom.dll
#26 0x0000000000435a82 in APP_SINGLE_TOP::OnRun (this=0x6862850)
    at D:/private-local/working/kicad/kicad/common/single_top.cpp:186
#27 0x000000006a547977 in ?? ()
   from C:\msys64\mingw64\bin\wxbase30u_gcc_custom.dll
#28 0x00000000061ca24b in ?? ()
   from C:\msys64\mingw64\bin\wxmsw30u_core_gcc_custom.dll
#29 0x00000000004016ec in WinMain (hInstance=0x400000, hPrevInstance=0x0,
    nCmdShow=10)
    at D:/private-local/working/kicad/kicad/common/single_top.cpp:260
#30 0x000000000045c502 in main (flags=<optimized out>,
    cmdline=<optimized out>, inst=<optimized out>)
    at C:/repo/mingw-w64-crt-git/src/mingw-w64/mingw-w64-crt/crt/crt0_c.c:18
#31 0x00000000004013a5 in __tmainCRTStartup ()
    at C:/repo/mingw-w64-crt-git/src/mingw-w64/mingw-w64-crt/crt/crtexe.c:339
#32 0x00000000004014db in WinMainCRTStartup ()
    at C:/repo/mingw-w64-crt-git/src/mingw-w64/mingw-w64-crt/crt/crtexe.c:195

[3] Version information:
Application: gerbview
Version: (6.0.0-rc1-dev-713-g90df7a8b2), debug build
Libraries:
    wxWidgets 3.0.4
    libcurl/7.61.1 OpenSSL/1.1.1 (WinSSL) zlib/1.2.11 brotli/1.0.6 libidn2/2.0.5 libpsl/0.20.2 (+libidn2/2.0.5) nghttp2/1.33.0
Platform: Windows 8 (build 9200), 64-bit edition, 64 bit, Little endian, wxMSW
Build Info:
    wxWidgets: 3.0.4 (wchar_t,wx containers,compatible with 2.8)
    Boost: 1.68.0
    OpenCASCADE Community Edition: 6.9.1
    Curl: 7.61.1
    Compiler: GCC 8.2.0 with C++ ABI 1013

Build settings:
    USE_WX_GRAPHICS_CONTEXT=OFF
    USE_WX_OVERLAY=OFF
    KICAD_SCRIPTING=ON
    KICAD_SCRIPTING_MODULES=ON
    KICAD_SCRIPTING_WXPYTHON=ON
    KICAD_SCRIPTING_ACTION_MENU=ON
    BUILD_GITHUB_PLUGIN=ON
    KICAD_USE_OCE=ON
    KICAD_USE_OCC=OFF
    KICAD_SPICE=ON

Tags: gerbview
Revision history for this message
Nabeel Ahmad (nbl14) wrote :
Revision history for this message
Seth Hillbrand (sethh) wrote :

I get the following assertion:

ASSERT INFO:
/home/seth/code/kicad/kicad-launchpad/gerbview/am_primitive.cpp(70): assert "params.size() && params[0].IsImmediate()" failed in IsAMPrimitiveExposureOn().

BACKTRACE:
[1] wxAppConsoleBase::CallEventHandler(wxEvtHandler*, wxEventFunctor&, wxEvent&) const
[2] wxEvtHandler::ProcessEventIfMatchesId(wxEventTableEntryBase const&, wxEvtHandler*, wxEvent&)
[3] wxEventHashTable::HandleEvent(wxEvent&, wxEvtHandler*)
[4] wxEvtHandler::TryHereOnly(wxEvent&)
[5] wxEvtHandler::DoTryChain(wxEvent&)
[6] wxEvtHandler::ProcessEvent(wxEvent&)
[7] wxWindowBase::TryAfter(wxEvent&)
[8] wxEvtHandler::SafelyProcessEvent(wxEvent&)
[9] wxMenuBase::SendEvent(int, int)
[10] g_closure_invoke
[11] g_signal_emit_valist
[12] g_signal_emit
[13] gtk_widget_activate
[14] gtk_menu_shell_activate_item
[15] g_closure_invoke
[16] g_signal_emit_valist
[17] g_signal_emit
[18] gtk_propagate_event
[19] gtk_main_do_event
[20] g_main_context_dispatch
[21] g_main_loop_run
[22] gtk_main
[23] wxGUIEventLoop::DoRun()
[24] wxEventLoopBase::Run()
[25] wxAppConsoleBase::MainLoop()
[26] wxEntry(int&, wchar_t**)
[27] __libc_start_main
[28] _start

Application: gerbview
Version: (6.0.0-rc1-dev-722-gf11cb736e), debug build
Libraries:
    wxWidgets 3.0.2
    libcurl/7.52.1 OpenSSL/1.0.2l zlib/1.2.8 libidn2/0.16 libpsl/0.17.0 (+libidn2/0.16) libssh2/1.7.0 nghttp2/1.18.1 librtmp/2.3
Platform: Linux 4.9.0-8-amd64 x86_64, 64 bit, Little endian, wxGTK
Build Info:
    wxWidgets: 3.0.2 (wchar_t,wx containers,compatible with 2.8) GTK+ 2.24
    Boost: 1.62.0
    Curl: 7.52.1
    Compiler: GCC 6.3.0 with C++ ABI 1010

Build settings:
    USE_WX_GRAPHICS_CONTEXT=OFF
    USE_WX_OVERLAY=OFF
    KICAD_SCRIPTING=OFF
    KICAD_SCRIPTING_MODULES=OFF
    KICAD_SCRIPTING_WXPYTHON=OFF
    KICAD_SCRIPTING_ACTION_MENU=OFF
    BUILD_GITHUB_PLUGIN=ON
    KICAD_USE_OCE=OFF
    KICAD_USE_OCC=OFF
    KICAD_SPICE=OFF

Changed in kicad:
status: New → Triaged
importance: Undecided → Medium
milestone: none → 5.1.0
Revision history for this message
KiCad Janitor (kicad-janitor) wrote :

Fixed in revision 606096b54860e7bd1bf27dee4c56f737ea1d4f67
https://git.launchpad.net/kicad/patch/?id=606096b54860e7bd1bf27dee4c56f737ea1d4f67

Changed in kicad:
status: Triaged → Fix Committed
assignee: nobody → jean-pierre charras (jp-charras)
Changed in kicad:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.