GNOME Bugzilla – Bug 353986
gnucash crash on ofx directconnect import
Last modified: 2018-06-29 21:12:15 UTC
Steps to reproduce: 1. start gnucash 2. get transactions through (suspect) directconnect aqbanking setup; aqbanking returns std::out_of_range error 3. gnucash crashes Stack trace:
+ Trace 71422
Other information: Other directconnect setups work fine (other banks), but this error forces a gnucash crash. LibOFX, Gwenhywfar, AqBanking, and Gnucash are all compiled from CVS/SVN. I'm using ubuntu dapper on an amd64. Below is stdout text: 3:2006/09/02 12-13-49:(null)(10461):provider.c: 735: Port is: 443 3:2006/09/02 12-13-49:gwen(10461):directory_all.c: 299: Trying "/home/user/unstable/gwenhywfar/etc/gwen-public-ca.crt" 3:2006/09/02 12-13-49:gwen(10461):directory_all.c: 306: File "gwen-public-ca.crt" found in folder "/home/user/unstable/gwenhywfar/etc" terminate called after throwing an instance of 'std::out_of_range' what(): basic_string::erase
Using Gnucash r14782, aqbanking r1055, gwenhywfar r1085.
Thanks for reporting this problem. However, as you can read from the stack trace, the actual error occurs inside libofx, not in aqbanking. Can you please tell us the exact libofx version -- if from CVS, the latest date in the ChangeLog? Also, can you please recompile libofx with -g and without -O2 so that the stack trace shows a bit more details in the libofx_proc_buffer function? Apart from this, I can only guess you need to do some more error reporting at the libofx project, because neither gnucash nor aqbanking could fix a problem of libofx.
The latest entry in the libofx Changelog is from 3/8/2006. Here's the more verbose trace:
+ Trace 71456
I'll also report this to libofx...
libofx bug is https://sourceforge.net/tracker/index.php?func=detail&aid=1551599&group_id=61170&atid=496353 but I'll continue the discussion here because bugzilla is more comfortable. Can you add two more bits of information, please: Did you obtain this stack trace within "gdb"? If no, please see http://wiki.gnucash.org/wiki/Stack_Trace on how to do this. If yes, please run (after the crash) the following commands inside gdb: up 8 print s print pos print s_buffer and give us the complete output. Thanks. The error is clearly caused by the command s_buffer.erase(pos+6) as "pos+6" is probably larger than the size of the s_buffer. However, it isn't obvious how this could be caused. The command should probably be prefixed by an if(s_buffer.size()>pos+6).
Also, can you try to fix this by editing the libofx file libofx/lib/ofx_preproc.cpp and change the line 274 so that it reads // erase everything after the /OFX tag if(s_buffer.size()>pos+6) s_buffer.erase(pos+6); Then compile and install libofx, and check whether the error still occurs.
After some wrestling to recompile libofx (I needed to uninstall gengetopt to get the problem libofx to compile again), here is the gdb dump. Gnucash still crashes. (gdb) up 8
+ Trace 73370
If I change ofx_preproc.cpp as you suggested, gnucash simply gives an Information box that says "The HBCI import returned no transactions for the selected time period." Nothing crashes. Interestingly, the same actions don't produce a crash if I use [the latest] libofx 25/8/06, gwenhywfar r1090, aqbanking r1068, and gnucash r14892. An Error box pops up that says "Error executing backend's queue. What shall I do? Continue/Abort." Thanks for all your help, Pete
Thanks for the additional details. The crash should be fixed in libofx and/or in aqbanking soon. But I guess additionally you would like to be able to retrieve your account statments. For this, we need additional ofx-directconnect debugging, which is available if you define the environment variable AQOFX_LOG_COMM to some value. THen, the ofx-directconnect code of aqbanking will create the log file /tmp/ofx.log, which might give you some hints about why there is a server error.
The crash is fixed in libofx-CVS (which will hopefully some day become libofx 0.8.3) by this change http://libofx.cvs.sourceforge.net/libofx/libofx/lib/ofx_preproc.cpp?r1=1.15&r2=1.16
*** Bug 392890 has been marked as a duplicate of this bug. ***
libofx 0.8.3 is released which fixes this crash.
*** Bug 416687 has been marked as a duplicate of this bug. ***
*** Bug 428387 has been marked as a duplicate of this bug. ***
*** Bug 474717 has been marked as a duplicate of this bug. ***
*** Bug 473849 has been marked as a duplicate of this bug. ***
*** Bug 490969 has been marked as a duplicate of this bug. ***
GnuCash bug tracking has moved to a new Bugzilla host. This bug has been copied to https://bugs.gnucash.org/show_bug.cgi?id=353986. Please update any external references or bookmarks.