Locks up and segfaults on loading a legacy .mod

Bug #1375419 reported by Tom Andrews
16
This bug affects 3 people
Affects Status Importance Assigned to Milestone
KiCad
Fix Released
High
Wayne Stambaugh

Bug Description

When I add the legacy part to the cvpcb/pcbnew library tables, KiCad crashes, and just won't load unless I remove that library from the table. It only occurs with the legacy plugin, therefore being a legacy plugin bug. I've been in the IRC and the bug has been reproduced elsewhere, I am also able to reproduce this whenever. I am using the latest version as of this post, and below is the backtrace of pcbnew.

EDIT: Tested with custom modules, and the bug only affects libs from http://library.oshec.org/ (Apparently well known to be broken).
Thanks,

Tom

Backtrace:
http://pastebin.com/AvHdST0t

Tags: legacy
Tom Andrews (gta4lj)
description: updated
Revision history for this message
Nick Østergaard (nickoe) wrote :

Setting to high because it segfaults.

Changed in kicad:
importance: Undecided → High
Revision history for this message
Nick Østergaard (nickoe) wrote :

I can add that this happens both on archlinux and also windows with 5155.

description: updated
Revision history for this message
Wayne Stambaugh (stambaughw) wrote :

Please attach the specific library that caused the segfault or send it to me directly. I'm not sure all of the libraries at http://library.oshec.org/ are broken.

Revision history for this message
Nick Østergaard (nickoe) wrote :

He linked this on IRC, which I have just named foo, because it was from a paste.

Revision history for this message
Michael Forsyth (forsyth) wrote :

Application: kicad
Version: (2014-09-30 BZR 5157)-product Release build
wxWidgets: Version 3.0.1 (debug,wchar_t,compiler with C++ ABI 1002,GCC 4.8.2,wx containers,compatible with 2.8)
Platform: Linux 3.13.0-36-generic x86_64, 64 bit, Little endian, wxGTK
Boost version: 1.54.0
         USE_WX_GRAPHICS_CONTEXT=OFF
         USE_WX_OVERLAY=OFF
         KICAD_SCRIPTING=OFF
         KICAD_SCRIPTING_MODULES=OFF
         KICAD_SCRIPTING_WXPYTHON=OFF
         USE_FP_LIB_TABLE=HARD_CODED_ON
         BUILD_GITHUB_PLUGIN=ON

Just built this version and it worked with one legacy mod added in a previous version but not the second added in this one
Library table can be edited from pcbnew. I removed the entry and it worked. I added it back in and crashed kicad
Anything I can try to help?

Revision history for this message
Wayne Stambaugh (stambaughw) wrote : Re: [Bug 1375419] Re: Locks up and segfaults on loading a legacy .mod

On 9/30/2014 6:39 PM, Michael Forsyth wrote:
> Application: kicad
> Version: (2014-09-30 BZR 5157)-product Release build
> wxWidgets: Version 3.0.1 (debug,wchar_t,compiler with C++ ABI 1002,GCC 4.8.2,wx containers,compatible with 2.8)
> Platform: Linux 3.13.0-36-generic x86_64, 64 bit, Little endian, wxGTK
> Boost version: 1.54.0
> USE_WX_GRAPHICS_CONTEXT=OFF
> USE_WX_OVERLAY=OFF
> KICAD_SCRIPTING=OFF
> KICAD_SCRIPTING_MODULES=OFF
> KICAD_SCRIPTING_WXPYTHON=OFF
> USE_FP_LIB_TABLE=HARD_CODED_ON
> BUILD_GITHUB_PLUGIN=ON
>
> Just built this version and it worked with one legacy mod added in a previous version but not the second added in this one
> Library table can be edited from pcbnew. I removed the entry and it worked. I added it back in and crashed kicad
> Anything I can try to help?
>

The mod file causing the problem would be useful so we can try to
duplicate your failure. If you downloaded the mod file from
http://library.oshec.org/ there is a good chance that is causing the
problem which was already reported here
https://bugs.launchpad.net/kicad/+bug/1375419. That being said, a
malformed mod file should not crash pcbnew.

Revision history for this message
Michael Forsyth (forsyth) wrote :

I just added another mod without problems

Revision history for this message
Michael Forsyth (forsyth) wrote :

Here is the one that was sucessfully added and used

Revision history for this message
Michael Forsyth (forsyth) wrote :

Gedit reports that m-pad-2.1.mod has invalid characters on lines 70578 ,70579
Cd JAUCH'S OSCILLATOR \B7 VX3 AND VX3L \B7 3.3 V SURFACE MOUNT CRYSTAL OSCILLATOR WITH TRISTATE FUNCTION
Kw JAUCH'S OSCILLATOR \B7 VX3 AND VX3L \B7 3.3 V SURFACE MOUNT CRYSTAL OSCILLATOR WITH TRISTATE FUNCTION
the \B7 are highlighted.

Revision history for this message
Michael Forsyth (forsyth) wrote :

I removed the characters in the file that gedit objected to as they are just descriptions. It still crashes so that was apparently not the source of the problem.
I'll try to find a smaller file that crashes.

Revision history for this message
Michael Forsyth (forsyth) wrote :

Found a small file that crashes no illegal characters.

Revision history for this message
Michael Forsyth (forsyth) wrote :

In the file that crashes the text fields lack a layer number

T0 -200 840 320 320 0 35 N V ">NAME"
T1 -40 1340 320 320 0 35 N V ">VALUE"
T2 165 3895 240 240 0 35 N V "21,5"
T3 250 -1750 500 500 0 35 N V "Goldcap"

Changed in kicad:
assignee: nobody → Wayne Stambaugh (stambaughw)
Revision history for this message
Wayne Stambaugh (stambaughw) wrote :

It's not the missing layer that is the problem. The legacy file parser
automatically assigns the front silk screen layer if the layer number is
missing. There is a bug in the parser that passes a null pointer any
time the field number (number after the T) is greater than 2. It hard
to imagine why this hasn't be caught before now. I guess most footprint
definitions do not define fields above T2. I'm in the process of
compiling and testing my fix. I should have the fix committed by the
end of the day. Thank you for the information. It made tracking down
this bug easier.

On 10/1/2014 12:29 AM, Michael Forsyth wrote:
> In the file that crashes the text fields lack a layer number
>
> T0 -200 840 320 320 0 35 N V ">NAME"
> T1 -40 1340 320 320 0 35 N V ">VALUE"
> T2 165 3895 240 240 0 35 N V "21,5"
> T3 250 -1750 500 500 0 35 N V "Goldcap"
>

Revision history for this message
Wayne Stambaugh (stambaughw) wrote :

I just committed the fix for this in r5160. You should now be able to load legacy footprint libraries with a field number greater than 2 without crashing.

Changed in kicad:
status: New → Fix Committed
Revision history for this message
Michael Forsyth (forsyth) wrote :

I'll try it as soon as it is available. As a former sw developer I am always glad to help. You are all doing a great job!

Revision history for this message
Michael Forsyth (forsyth) wrote :

Rebuilt , tested and Fixed!

Jon Neal (reportingsjr)
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.