pcb

Picking load netlist menu item causes segfault

Bug #1788845 reported by Larry Battraw on 2018-08-24
18
This bug affects 3 people
Affects Status Importance Assigned to Milestone
pcb
High
Chad Parker

Bug Description

Running current git checkout (v4.1.2-g22d76d98) PCB on ARM Ubuntu Bionic system (18.04.1 LTS, kernel 4.14.66-147, on an ODroid-XU4).
  Picking the "load netlist" option from the File menu causes immediate segmentation fault. Nothing needs to be done to reproduce it, it happens every single time whether the program is just started or if it has a PCB file loaded. I cloned the git repo and built it today, nothing fancy :-)

dmn (graahnul.grom) wrote :

The same with 'File->Open...', 'File->Load element to buffer...' and 'File->Load layout to buffer...'.
It turned out that these bugs were introduced in the last commit (22d76d9). The attached patch tries to fix them (it works for me).
Hope this will help.

Regards,
Dmitry.

Larry Battraw (lbattraw) wrote :

Yes, this fixes the issues-- Thanks! I'm glad to hear it wasn't a platform-specific bug.

Chad Parker (parker-charles) wrote :

Wow. Unintended consequences.

I have to do a little more work to reproduce this, but, I think I can.

1. Start pcb.
2. File > New
3. OK
4. File > Load
<crash>

Interestingly, if I do the File > Load before the File > New, I don't get a crash.

I've fixed this and pushed it to master. Please let me know if you continue to have any issues.

Changed in pcb:
importance: Undecided → High
assignee: nobody → Chad Parker (parker-charles)
status: New → Fix Committed
Changed in pcb:
milestone: none → pcb-4.1.3
dmn (graahnul.grom) wrote :

Charles, the fix works if PCB->Filename contains full path.
pcb still segfaults if invoked with relative file name. i.e.:

> pcb /path/to/board.pcb => OK
> pcb board.pcb => segmentation fault on File->Load

Segfault happens because of this expression:

*strrchr(default_dir, PCB_DIR_SEPARATOR_C) = 0;

strrchr() returns NULL if there's no PCB_DIR_SEPARATOR_C in default_dir (that is the case for relative file path).

Chad Parker (parker-charles) wrote :

Okay, take 2. I, again, tweaked your patch a little. I think everything ought to work the way it's supposed to know. Can you confirm?

dmn (graahnul.grom) wrote :

It works, thank you!

Chad Parker (parker-charles) wrote :

Great. Sorry for the inconvenience. Thanks for your patches and testing. They were very helpful!

Changed in pcb:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers