After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 719726 - Click on File -> Open seg-faults in gnc_uri_get_components in gnucash gnc-uri-utils.c:137
Click on File -> Open seg-faults in gnc_uri_get_components in gnucash gnc-uri...
Status: RESOLVED FIXED
Product: GnuCash
Classification: Other
Component: General
2.5.x
Other Linux
: Normal critical
: ---
Assigned To: gnucash-general-maint
gnucash-general-maint
: 720471 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2013-12-02 22:07 UTC by Herbert Mühlburger
Modified: 2018-06-29 23:22 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
gdb debug output incl. full backtrace (39.64 KB, text/plain)
2013-12-02 22:07 UTC, Herbert Mühlburger
Details

Description Herbert Mühlburger 2013-12-02 22:07:13 UTC
Created attachment 263344 [details]
gdb debug output incl. full backtrace

GnuCash crashes with a segmentation fault in gnc_uri_get_components in gnucash gnc-uri-utils.c:137 when user clicks on "File" -> "Open". Note that no account hiearchy was previously created. User intents to open an existing account hierarchy and not to create a new one.

Steps to Reproduce:

    0) Downloaded gnucash sourcecode and built it.
    1) Deleted ~/.gnucash
    2) Clicked on "File" -> "Open"

    The application crashed.

    The file selector window should open and let the user define which account hiearchy to open. (Or, at least, the application should not crash.)

    Build 2013-12-02 on Ubuntu Linux (from git commit 7492f1460629d5d5d6570f59d9017f5ddf631b20)
    Occurs on Mac OS X 10.9 build 2.5.9-1 (http://downloads.sourceforge.net/sourceforge/gnucash/unstable/gnucash-Intel-2.5.9-1.dmg) as well.

See attachment for the debugging trace using gdb.
Comment 1 John Ralls 2013-12-02 23:48:05 UTC
I had to create a new user to replicate the crash, because the underlying problem is provoked when there is no history list and I can't find where gsettings is putting the blinking history list.

The root cause of the problem is in gnc_uri_get_components() here:
    splituri = g_strsplit ( uri, "://", 2 );
    if ( splituri[1] == NULL )
The problem is that if uri is "", g_strsplit returns a pointer to (gchar*)NULL, allocated on the heap. splituri[1] is whatever is next on the heap.

The simplest fix is to check for an empty string in the initial g_return_if_fail(), pushed in r23478.

As a work-around, you can run
  gnucash /path/to/account/file
or on OSX
  /Applications/Gnucash.app/Contents/MacOS/Gnucash /path/to/account/file
Comment 2 John Ralls 2013-12-15 00:45:22 UTC
*** Bug 720471 has been marked as a duplicate of this bug. ***
Comment 3 John Ralls 2018-06-29 23:22:12 UTC
GnuCash bug tracking has moved to a new Bugzilla host. This bug has been copied to https://bugs.gnucash.org/show_bug.cgi?id=719726. Please update any external references or bookmarks.