pcb

png hid segfaults when using --photo-mode --photo-flip-x if "solder" layer is not in "Solder side"

Bug #796389 reported by Adrian Pardini
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
pcb
New
Undecided
Unassigned

Bug Description

If the "solder" layer is not marked as belonging to the "Solder side" pcb segfaults if called as

pcb -x png --photo-mode --only-visible --photo-flip-x --outfile out_flip.png board.pcb

because it uses photo_copper[photo_groups[0]] without checking for NULL first.

Revision history for this message
Adrian Pardini (pardo-bsso) wrote :

Fixes the segfault. Maybe it is better to bail out or print an error message instead of this?

Revision history for this message
DJ Delorie (djdelorie) wrote : Re: [Pcb-bugs] [Bug 796389] Re: png hid segfaults when using --photo-mode --photo-flip-x if "solder" layer is not in "Solder side"

If we can meaningfully interpret this type of side-less grouping, we
should attempt to draw it as best as we can imagine it would look
like. I think the patch is fine, however, perhaps we should check the
component side as well. I can easily imagine a one-sided board with
copper only on the solder side - my old VCR had one :-)

Revision history for this message
Adrian Pardini (pardo-bsso) wrote :

Well, I discovered this by mistake. Here I can't make it crash doing the same with the copper layer but the code already look for photo_copper[photo_groups[1]] not being null.

At that moment setting the layer as transparent made sense to me but I don't know what is reasonable to expect. Maybe some warning message? I had a hard time before figuring out that I misplaced the layers.

Traumflug (mah-jump-ing)
Changed in geda-project:
importance: Undecided → Critical
Revision history for this message
Traumflug (mah-jump-ing) wrote :

I couldn't reproduce the crash, but looking at the code I found that the patch wasn't applied, yet. So I applied it and added another commit on top of it to do even more checks for existence. Exporting a photo-PNG and 'make distcheck' still works fine. Pushed to branch LP796389, please test.

Thanks for the report, the catch and the patch.

Changed in geda-project:
status: New → In Progress
Revision history for this message
Adrian Pardini (pardo-bsso) wrote :

Thanks Traumflug!

I'll try to reproduce it tonight.

Revision history for this message
Traumflug (mah-jump-ing) wrote :

You didn't tell us the day of the 'tonight' ... :-)

Anyways. Forwarded these two commits to master, thank you for your patch and for bringing the case up.

Changed in geda-project:
status: In Progress → Fix Committed
Traumflug (mah-jump-ing)
Changed in geda-project:
status: Fix Committed → Fix Released
tags: added: png-export segfault
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.