[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: gEDA-user: pcb segmentation fault



On Fri, 2009-03-06 at 13:19 +0300, Ineiev wrote:
> On 3/6/09, DJ Delorie <dj@xxxxxxxxxxx> wrote:
> >
> > Could you send me a board that triggers this?
> >
> >
> > _______________________________________________
> > geda-user mailing list
> > geda-user@xxxxxxxxxxxxxx
> > http://www.seul.org/cgi-bin/mailman/listinfo/geda-user
> >
> 
> Recently, this board triggered a similar bug in gerber exporter:
> FileVersion[20070407]
> 
> PCB["" 450000 270000]
> 
> Grid[1.000000 0 0 1]
> Cursor[1000 323000 6.000000]
> PolyArea[200000000.000000]
> Thermal[0.500000]
> DRC[600 600 600 800 1200 1000]
> Groups("1,c:2,s")
> 
> Via[10000 50000 16000 2000 17000 12000 "" "hole"]
> Layer(1 "component")
> (
> )
> Layer(2 "solder")
> (
> )
> Layer(3 "backsilk")
> (
> )
> Layer(4 "frontsilk")
> (
> )
> 
> The drill file contained the next (note G54D0, etc):
> M48
> INCH
> T11C0.120
> %
> G54D0*X4000Y220000D02*G75*G03X4000Y220000I6000J0D01*G01*
> T11
> X001000Y022000
> M30
> 
> I misfixed it with this:
> diff --git a/src/hid/gerber/gerber.c b/src/hid/gerber/gerber.c
> index 7fc62f9..e0dea23 100644
> --- a/src/hid/gerber/gerber.c
> +++ b/src/hid/gerber/gerber.c
> @@ -870,7 +870,7 @@ gerber_draw_arc (hidGC gc, int cx, int cy, int
> width, int height,
>    Boolean m = False;
>    float arcStartX, arcStopX, arcStartY, arcStopY;
> 
> -  if (gc->width == 1)
> +  if (gc->width <= 1)
>      return;
> 
>    use_gc (gc, 0);
> 
> Probably other exporters are affected after commit
> 8dd739f9bd72dc3c8beb6e4e5e32c124cac0d13b
> 
> Regards,
>    Ineiev

Hmm, I thought exporters weren't supposed to be being passed hairlines
in the first place.. but I see in the case of holes, they are.

Good catch!

I wonder if the correct test should just be:

if (gc->width == 0)
  return;

(Which makes it reject hairlines, but not lines of 1 PCB internal unit).

I'd guess that other exporters should actually draw the hairlines if
that is something sensible for them to do. (PNG?).

DJ, I guess you might know more on this.. what are the invariants
supposed to be? Is it the HID's job to reject hairline drawing if the
exporter doesn't want it, or is the core at fault for asking to draw
primitives which aren't needed by a given exporter?

Best regards,

-- 
Peter Clifton

Electrical Engineering Division,
Engineering Department,
University of Cambridge,
9, JJ Thomson Avenue,
Cambridge
CB3 0FA

Tel: +44 (0)7729 980173 - (No signal in the lab!)



_______________________________________________
geda-user mailing list
geda-user@xxxxxxxxxxxxxx
http://www.seul.org/cgi-bin/mailman/listinfo/geda-user