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

Re: gEDA-user: pcb segmentation fault



Ok,


Id did some investigation on this.

src/hid/png/png.c:1093

I found that when  gdImageCreate(r,r) is called with r=0, it'll not create
anything and will returm NULL. It is confirmed by the documetation.

Since the gc->brush is null, it will cause the segfault
when gdImageColorAllocate(null,...) called.

Patch attached. I'm not sure if it is the right thing, but it works for me....
And I don't know why r gets 0.

Levente 


On Thu, 5 Mar 2009 00:32:33 +0100
Levente Kovacs <leventelist@xxxxxxxxx>
wrote:

> Hi,
> 
> 
> If I do
> 
> pcb -x png --format PNG --dpi 600 --photo-mode --outfile af_cs.png
> af.pcb
> 
> I get:
> 
> ...
> gd warning: one parameter to a memory allocation multiplication is
> negative or zero, failing operation gr acefully
> 
> Program received signal SIGSEGV, Segmentation fault.
> [Switching to Thread 0x7f452e7956e0 (LWP 10735)]
> 0x00007f452c0737e0 in gdImageColorAllocateAlpha ()
> from /usr/lib/libgd.so.2 (gdb) where
> #0  0x00007f452c0737e0 in gdImageColorAllocateAlpha ()
> #from /usr/lib/libgd.so.2 1  0x000000000049e676 in use_gc
> #(gc=0x21c66c0) at hid/png/png.c:1098 2  0x000000000049ec19 in
> #png_draw_arc (gc=0x0, cx=364075, cy=90157, width=5905, height=5905, 
>     start_angle=255, delta_angle=0) at hid/png/png.c:1269
> #3  0x000000000043a37d in hole_callback (b=0x22444f8, cl=<value
> #optimized out>) at draw.c:1121 4  0x00000000004765a8 in __r_search
> #(node=0x22451d0, query=0x7fff367b0990, arg=0x7fff367b0850)
>     at rtree.c:539
> #5  0x00000000004765bf in __r_search (node=<value optimized out>,
> #query=0x7fff367b0990, 
>     arg=0x7fff367b0850) at rtree.c:589
> #6  0x00000000004765bf in __r_search (node=<value optimized out>,
> #query=0x7fff367b0990, 
>     arg=0x7fff367b0850) at rtree.c:589
> #7  0x00000000004765bf in __r_search (node=<value optimized out>,
> #query=0x7fff367b0990, 
>     arg=0x7fff367b0850) at rtree.c:589
> #8  0x0000000000476636 in r_search (rtree=<value optimized out>,
> #query=0xff, 
>     check_region=<value optimized out>, found_rectangle=0xff, cl=0x0)
> at rtree.c:625
> #9  0x000000000043e51f in hid_expose_callback (hid=<value optimized
> #out>, region=0x7fff367b0990, 
>     item=<value optimized out>) at draw.c:465
> #10 0x000000000049fb95 in png_hid_export_to_file (the_file=<value
> #optimized out>, options=0x6f3880)
>     at hid/png/png.c:355
> #11 0x00000000004a019a in png_do_export (options=0x6f3880) at
> #hid/png/png.c:624 12 0x0000000000451611 in main (argc=2,
> #argv=0x7fff367b0cf0) at main.c:971
> 
> This is on ubuntu, and with a git version of PCB. It fails with all
> of my layouts.
> 
> uname -a
> Linux jive 2.6.27-11-generic #1 SMP Thu Jan 29 19:28:32 UTC 2009
> x86_64 GNU/Linux
> 
> Cheers,
> Levente
> 
> -- 
> Levente Kovacs
> http://logonex.eu
> 
> 
> 
> _______________________________________________
> geda-user mailing list
> geda-user@xxxxxxxxxxxxxx
> http://www.seul.org/cgi-bin/mailman/listinfo/geda-user
> 


-- 
Levente Kovacs
http://logonex.eu

Attachment: png.c_diff
Description: Binary data


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