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 678103 - Crash when creating new invoice
Crash when creating new invoice
Status: RESOLVED OBSOLETE
Product: GnuCash
Classification: Other
Component: Business
2.4.x
Other Linux
: Normal critical
: ---
Assigned To: Christian Stimming
gnucash-core-maint
Depends on:
Blocks:
 
 
Reported: 2012-06-14 14:28 UTC by Steven Stern
Modified: 2018-06-29 23:09 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
2.4.11 invoice creation backtrace (4.78 KB, text/plain)
2013-01-25 06:11 UTC, Danny Robson
  Details
Does this change fix the bug? (1.88 KB, patch)
2013-06-14 21:35 UTC, Christian Stimming
none Details | Review

Description Steven Stern 2012-06-14 14:28:14 UTC
Clicking OK to create a new invoice causes a segfault


(gdb) continue
Continuing.

Program received signal SIGSEGV, Segmentation fault.
0x4485204a in g_str_hash (v=0x732e7265) at ghash.c:1730
1730	  for (p = v; *p != '\0'; p++)
(gdb) bt
  • #0 g_str_hash
    at ghash.c line 1730
  • #1 g_hash_table_lookup_node
    at ghash.c line 401
  • #2 g_hash_table_lookup
    at ghash.c line 1074
  • #3 gnc_cell_factory_make_cell
    at cell-factory.c line 110
  • #4 gnc_register_make_cell
    at register-common.c line 94
  • #5 gnc_register_add_cell
  • #6 gnc_entry_ledger_layout_add_cells
    at gncEntryLedgerLayout.c line 156
  • #7 gnc_entry_ledger_layout_new
    at gncEntryLedgerLayout.c line 274
  • #8 gnc_entry_ledger_new
    at gncEntryLedger.c line 322
  • #9 gnc_invoice_create_page
  • #10 gnc_plugin_page_invoice_create_widget
    at gnc-plugin-page-invoice.c line 457
  • #11 gnc_plugin_page_create_widget
    at gnc-plugin-page.c line 157
  • #12 gnc_main_window_open_page
    at gnc-main-window.c line 2593
  • #13 gnc_invoice_new_page
    at dialog-invoice.c line 1940
  • #14 gnc_ui_invoice_edit
    at dialog-invoice.c line 2368
  • #15 gnc_invoice_window_ok_cb
    at dialog-invoice.c line 409
  • #16 g_cclosure_marshal_VOID__VOID
    at gmarshal.c line 85
  • #17 g_closure_invoke
  • #18 signal_emit_unlocked_R
    at gsignal.c line 3547
  • #19 g_signal_emit_valist
    at gsignal.c line 3296
  • #20 g_signal_emit
    at gsignal.c line 3352
  • #21 IA__gtk_button_clicked
    at gtkbutton.c line 1128
  • #22 gtk_real_button_released
    at gtkbutton.c line 1725
  • #23 gtk_real_button_released
    at gtkbutton.c line 1715
  • #24 g_cclosure_marshal_VOID__VOIDv
    at gmarshal.c line 115
  • #25 g_type_class_meta_marshalv
  • #26 _g_closure_invoke_va
    at gclosure.c line 840
  • #27 g_signal_emit_valist
    at gsignal.c line 3207
  • #28 g_signal_emit
    at gsignal.c line 3352
  • #29 gtk_button_released
    at gtkbutton.c line 1120
  • #30 gtk_button_button_release
    at gtkbutton.c line 1617
  • #31 gtk_button_button_release
  • #32 _gtk_marshal_BOOLEAN__BOXED
    at gtkmarshalers.c line 86
  • #33 g_type_class_meta_marshal
    at gclosure.c line 970
  • #34 g_closure_invoke
    at gclosure.c line 777
  • #35 signal_emit_unlocked_R
    at gsignal.c line 3585
  • #36 g_signal_emit_valist
    at gsignal.c line 3306
  • #37 g_signal_emit
  • #38 gtk_widget_event_internal
    at gtkwidget.c line 4999
  • #39 IA__gtk_widget_event
    at gtkwidget.c line 4796
  • #40 IA__gtk_propagate_event
    at gtkmain.c line 2489
  • #41 IA__gtk_main_do_event
    at gtkmain.c line 1684
  • #42 gdk_event_dispatch
    at gdkevents-x11.c line 2377
  • #43 g_main_dispatch
    at gmain.c line 2539
  • #44 g_main_context_dispatch
    at gmain.c line 3075
  • #45 g_main_context_iterate
    at gmain.c line 3146
  • #46 g_main_loop_run
    at gmain.c line 3340
  • #47 IA__gtk_main
    at gtkmain.c line 1256
  • #48 gnc_ui_start_event_loop
    at gnc-gnome-utils.c line 668
  • #49 inner_main
    at gnucash-bin.c line 735
  • #50 invoke_main_func
    at init.c line 367
  • #51 c_body
    at continuations.c line 349
  • #52 scm_c_catch
    at throw.c line 203
  • #53 scm_i_with_continuation_barrier
    at continuations.c line 325
  • #54 scm_c_with_continuation_barrier
    at continuations.c line 367
  • #55 scm_i_with_guile_and_parent
    at threads.c line 733
  • #56 scm_with_guile
    at threads.c line 721
  • #57 scm_boot_guile
    at init.c line 350
  • #58 main
    at gnucash-bin.c line 877

Comment 1 John Ralls 2012-06-14 21:13:11 UTC
Very odd. The problem comes from here:
  • #5 gnc_register_add_cell
  • #6 gnc_entry_ledger_layout_add_cells
    at gncEntryLedgerLayout.c line 156

Here's the relevant call at gncEntryLedgerLayout.c:156
    for (i = 0; i < (sizeof(cells) / sizeof(*cells)); i++)
        gnc_register_add_cell (layout, cells[i].cell_name,
                               cells[i].cell_type_name,
                               cells[i].sample_text, cells[i].alignment,
                               cells[i].expandable, cells[i].span);

Note that the cell_type_name is out of bounds, but it's created on the stack in gnc_entry_ledger_layout_add_cells as a string constant.
Comment 2 Steven Stern 2012-06-24 14:53:19 UTC
Fixed in 2.4.10-4

Thanks!
Comment 3 Danny Robson 2013-01-25 06:09:32 UTC
I'm experiencing the same crashing behaviour described above, running GnuCash 2.4.11 from r22264M under Gentoo. Filling out the 'New Invoice' form works fine until I click 'Ok', at which point it immediate segfaults.

Attaching backtrace.
Comment 4 Danny Robson 2013-01-25 06:11:28 UTC
Created attachment 234366 [details]
2.4.11 invoice creation backtrace
Comment 5 Geert Janssens 2013-03-12 13:50:27 UTC
Reopening this bug because a possible regression was detected in 2.4.11. Needs to be investigated further.
Comment 6 Christian Stimming 2013-06-13 20:53:09 UTC
(In reply to comment #3)
> I'm experiencing the same crashing behaviour described above, running GnuCash
> 2.4.11 from r22264M under Gentoo. Filling out the 'New Invoice' form works fine
> until I click 'Ok', at which point it immediate segfaults.

I'd like to reproduce the problem here, but on my Ubuntu and with current SVN-trunk (gnucash 2.5.2) it does not crash. Is there any chance for you to test also a 2.5.1 or 2.5.2 version of gnucash, or even SVN trunk? If I send you some changed source code, is it possible for you to compile this and check whether the crash might go away?
Comment 7 Christian Stimming 2013-06-14 21:35:40 UTC
Created attachment 246858 [details] [review]
Does this change fix the bug?

I can't reproduce the crash on my system. I can only guess from the backtrace that there might be some problem with the loop termination due to the sizeof() operator, maybe due to unexpected optimizations. If that's indeed the reason, the attached patch might fix this: The loop termination is done by an explicit NULL element.

@Danny: Any chance you can test whether the shown modification in the gnucash source code fixes this bug? It concerns only four lines in the file 
src/business/business-ledger/gncEntryLedgerLayout.c . You can unpack the source code, modify that file, then pack this into a tarball again and let your system compile this modified version. The patch will probably work with any 2.4 or 2.5 version of gnucash.
Comment 8 Geert Janssens 2013-06-15 08:21:19 UTC
I'm afraid I can't evaluate this. The crash never happened on my system so there's no way for me to say if the patch will fix this bug.

A have set the status to NEEDINFO. Hopefully Danny can give feedback here ?
Comment 9 Danny Robson 2013-06-15 09:29:20 UTC
I had a quick recheck prior to checking out the code for patching but I can no longer replicate the issue here with any of the accounts that were causing problems previously.

It looks like Gnucash has been updated through my package manager on Gentoo to 2.4.12 r22850M.

I'll try to keep an eye on it now that I know it's working and let you know if I can replicate it, but it looks Ok for the time being. Apologies for not noticing earlier.. Thanks for looking into it.
Comment 10 Christian Stimming 2013-06-16 08:48:46 UTC
Is there any place where I can look up the compile options used by the package manager when the buggy version 2.4.11 r22264M (which is just the SVN revision number of the 2.4.11 release) was built?

@Geert: Sure, that's what I expected. Neither you nor me could reproduce the bug so far, so we can't tell whether it's fixed. 

@Danny: If the bug has disappeared with 2.4.12, that's good, but I'd still like to be able to reproduce the bug because the relevant code was unchanged between 2.4.11 and 2.4.12 (and trunk).
Comment 11 Christian Stimming 2013-06-20 15:14:53 UTC
The gentoo ebuild file for 2.4.11-r1 is here:

http://sources.gentoo.org/cgi-bin/viewvc.cgi/gentoo-x86/app-office/gnucash/

Maybe it is possible to build the 2.4.11 version again and try to reproduce this bug? However, I don't run gentoo so I can't do this myself. Anyone being able to do this?
Comment 12 Christian Stimming 2013-07-05 14:31:54 UTC
I received feedback from another user who compiled gnucash-2.4.11 on Sabayon (which is supposed to be a "binary version of gentoo", whatever that is). That user cannot reproduce the crash reported above.

Unless someone else can reproduce the crash (and subsequently test whether the attached patch fixes the problem) we will have to close this bug and hope it has vanished by itself. The good report about 2.4.12 on gentoo sounds good enough.
Comment 13 John Ralls 2017-09-24 22:46:29 UTC
Reassign version to 2.4.x so that individual 2.4 versions can be retired.
Comment 14 John Ralls 2018-06-29 23:09:10 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=678103. Please update any external references or bookmarks.