pcbnew crash when pad clearance "too negative"

Bug #1663173 reported by Jean-Samuel Reynaud
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
KiCad
Fix Released
Undecided
Jean-Samuel Reynaud

Bug Description

I experience a crash in pcbnew when pad clearance is "too negative"
according to the pad shape.

To reproduce:
- Open pcbnew (In OpenGL canvas)
- Open footprint editor
- Create a new footprint
- Place a new SMD rectangular PAD of 1.5mmx1.5mm size
- Change footprint properties and set "Pad clearance" to -1 (in mm)
=> pcbnew crash

It is crashing because at pcbnew/pcb_painter.cpp:777 a polyset is filled
based on shape and clearance:

aPad->TransformShapeWithClearanceToPolygon ...

But in this case (parameter of clearance) the returned polyset is empty

so code at pcbnew/pcb_painter.cpp:783

m_gal->DrawPolyline( polySet.COutline( 0 ) );

always crash because polySet has an empty m_poly property (crash in
COutline in fact...).

To fix this:
Check polySet is not empty:

        if( polySet.OutlineCount() > 0 )
             m_gal->DrawPolyline( polySet.COutline( 0 ) );

other solution:
Modify SHAPE_POLY_SET::COutline(int aIndex)
(include/geometry/shape_poly_set.h:190)
To deny "aIndex" out of range values...

An other solution:
Perhaps it's not logical to allow negative values but in this case
interface should deny enter a negative value (and check existing values
from footprint/schematics...)...

Application: pcbnew
Version: no-vcs-found-7613~59~ubuntu16.04.1-experimental, release build
Libraries: wxWidgets 3.0.2
           libcurl/7.47.0 OpenSSL/1.0.2g zlib/1.2.8 libidn/1.32 librtmp/2.3
Platform: Linux 4.4.0-62-generic x86_64, 64 bit, Little endian, wxGTK
- Build Info -
wxWidgets: 3.0.2 (wchar_t,wx containers,compatible with 2.8)
Boost: 1.58.0
Curl: 7.47.0
KiCad - Compiler: GCC 5.4.0 with C++ ABI 1009
        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_SCH_IO_MANAGER=ON
                  KICAD_USE_OCE=ON

Revision history for this message
KiCad Janitor (kicad-janitor) wrote :

Fixed in revision 3ec6f1d33bd146feee5b2161d58e88f979b0e0b7
https://git.launchpad.net/kicad/patch/?id=3ec6f1d33bd146feee5b2161d58e88f979b0e0b7

Changed in kicad:
status: New → Fix Committed
assignee: nobody → js-reynaud (js-reynaud)
Revision history for this message
Jean-Samuel Reynaud (js-reynaud) wrote :

Some new code modification generate this bug one more time.

Changed in kicad:
status: Fix Committed → New
Revision history for this message
KiCad Janitor (kicad-janitor) wrote :

Fixed in revision 46edf6519c7c7e01f92571350f92a499781486d8
https://git.launchpad.net/kicad/patch/?id=46edf6519c7c7e01f92571350f92a499781486d8

Changed in kicad:
status: New → Fix Committed
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.