← Back to team overview

kicad-developers team mailing list archive

Re: SIGFPE in pad properties using GAL module editor

 

The attached patch fixes the crash but it appears that the vanishing
pads is a separate, unrelated bug.

Want me to look into that too? The crash was my main priority (my focus
right now is fixing bugs that keep me from getting my work done) but if
I get time I can investigate the disappearing pad bug too.

On Sun, 2014-07-27 at 14:36 -0400, Andrew Zonenberg wrote:
> Interesting. I'll add a divide-by-zero check to the line that it died on
> and see if that fixes the problem. Will send a patch if it works.
> 
> On Sun, 2014-07-27 at 20:32 +0200, Nick Østergaard wrote:
> > Tried it with your exact settings, no difference. I do see that the
> > preview vanishes when I enter zero in that field, and will not refresh
> > even if I write a non-zero value -- untill I accpet the settings and
> > open the properties again. But my build is not a debug build, so I
> > guess that the exception you get is just silenced for me.
> > 
> > 2014-07-27 20:23 GMT+02:00 Andrew Zonenberg <azonenberg@xxxxxxxxxxxxxxx>:
> > > Exact pad properties I was using if it's any help:
> > >
> > > http://i.imgur.com/DvnE9sI.png
> > >
> > > http://i.imgur.com/1f32yDz.png
> > >
> > > Fully reproducible, I can trigger it on command.
> > >
> > > On Sun, 2014-07-27 at 20:22 +0200, Nick Østergaard wrote:
> > >> I cannot reproduce with 5018 on linux.
> > >>
> > >> 2014-07-27 20:17 GMT+02:00 Andrew Zonenberg <azonenberg@xxxxxxxxxxxxxxx>:
> > >> > Steps to reproduce:
> > >> > * Open the GAL module editor
> > >> > * Add a new pad to the module
> > >> > * Highlight the "size X" field
> > >> > * Begin to type "0.5" or any other decimal with a leading zero
> > >> > * As soon as the "0" is entered, a SIGFPE is thrown
> > >> >
> > >> > --
> > >> > Andrew Zonenberg
> > >> > PhD student, security group
> > >> > Computer Science Department
> > >> > Rensselaer Polytechnic Institute
> > >> > http://colossus.cs.rpi.edu/~azonenberg/
> > >> >
> > >> > _______________________________________________
> > >> > Mailing list: https://launchpad.net/~kicad-developers
> > >> > Post to     : kicad-developers@xxxxxxxxxxxxxxxxxxx
> > >> > Unsubscribe : https://launchpad.net/~kicad-developers
> > >> > More help   : https://help.launchpad.net/ListHelp
> > >> >
> > >
> > > --
> > > Andrew Zonenberg
> > > PhD student, security group
> > > Computer Science Department
> > > Rensselaer Polytechnic Institute
> > > http://colossus.cs.rpi.edu/~azonenberg/
> 
> _______________________________________________
> Mailing list: https://launchpad.net/~kicad-developers
> Post to     : kicad-developers@xxxxxxxxxxxxxxxxxxx
> Unsubscribe : https://launchpad.net/~kicad-developers
> More help   : https://help.launchpad.net/ListHelp

-- 
Andrew Zonenberg
PhD student, security group
Computer Science Department
Rensselaer Polytechnic Institute
http://colossus.cs.rpi.edu/~azonenberg/
=== modified file 'pcbnew/class_pad.cpp'
--- pcbnew/class_pad.cpp	2014-07-09 12:01:06 +0000
+++ pcbnew/class_pad.cpp	2014-07-27 18:52:30 +0000
@@ -965,6 +965,11 @@
     // Netnames will be shown only if zoom is appropriate
     if( IsNetnameLayer( aLayer ) )
     {
+        // Pad sizes can be zero briefly when someone is typing a number like "0.5" in the pad properties dialog.
+        // Fail gracefully if this happens.
+        if( (m_Size.x == 0) && (m_Size.y == 0) )
+            return UINT_MAX;
+
         return ( 100000000 / std::max( m_Size.x, m_Size.y ) );
     }
 

Attachment: signature.asc
Description: This is a digitally signed message part


Follow ups

References