| Summary: | skrooge crash on ofx import | ||
|---|---|---|---|
| Product: | [Applications] skrooge | Reporter: | Luka Renko <lure> |
| Component: | general | Assignee: | Stephane MANKOWSKI <stephane> |
| Status: | RESOLVED FIXED | ||
| Severity: | crash | CC: | benoitg, stephane |
| Priority: | NOR | ||
| Version First Reported In: | unspecified | ||
| Target Milestone: | 25.1.0 | ||
| Platform: | Ubuntu | ||
| OS: | Linux | ||
| Latest Commit: | Version Fixed/Implemented In: | ||
| Sentry Crash Report: | |||
| Attachments: | test.ofx - sample file to reproduce the crash | ||
|
Description
Luka Renko
2010-10-24 19:17:54 UTC
This are last messages on console:
## >SKGDocument::beginTransaction
## Input parameter [name]=[Import with codec UTF-8]
## Input parameter [iSqlOrder]=[BEGIN;]
## >SKGDocument::getTransactionToProcess
## <SKGDocument::getTransactionToProcess
## Input parameter [iSqlOrder]=[insert into doctransaction (d_date, t_name, i_parent) values ('2010-10-24 19:21:45','Import with codec UTF-8', 6);]
## >SKGDocument::getTransactionToProcess
## <SKGDocument::getTransactionToProcess
## <SKGDocument::beginTransaction RC=[SUC-0]
## >SKGDocument::setParameter
## Input parameter [iName] =[SKG_LAST_CODEC_USED_FOR_IMPORT]
## Input parameter [iValue] =[UTF-8]
## >SKGObjectBase::save
## >SKGDocument::checkExistingTransaction
## <SKGDocument::checkExistingTransaction RC=[SUC-0]
## Input parameter [iSqlOrder]=[INSERT INTO parameters ('t_name','t_value','t_uuid_parent') VALUES ('SKG_LAST_CODEC_USED_FOR_IMPORT','UTF-8','document')]
## >SKGObjectBase::load
## <SKGObjectBase::load RC=[SUC-0]
## <SKGObjectBase::save RC=[SUC-0]
## <SKGDocument::setParameter RC=[SUC-0]
## >SKGImportExportManager::setCodec
## <SKGImportExportManager::setCodec RC=[SUC-0]
## >SKGImportExportManager::importFile
## Input parameter [iSqlOrder]=[ANALYZE]
## >SKGDocumentBank::importOFX
## Input filename=/home/lukar/Documents/Fin/Izvozi/2010/test.ofx
## >SKGDocument::beginTransaction
## Input parameter [name]=[#INTERNAL#]
## <SKGDocument::beginTransaction RC=[SUC-0]
Qt has caught an exception thrown from an event handler. Throwing
exceptions from an event handler is not supported in Qt. You must
reimplement QApplication::notify() and catch all exceptions there.
terminate called after throwing an instance of 'std::out_of_range'
what(): basic_string::substr
QSocketNotifier: Invalid socket 12 and type 'Read', disabling...
KCrash: Application 'skrooge' crashing...
KCrash: Attempting to start /usr/lib/kde4/libexec/drkonqi from kdeinit
sock_file=/home/lukar/.kde/socket-lure/kdeinit4__0
Created attachment 52831 [details]
test.ofx - sample file to reproduce the crash
I have used binary search to limit crash to single day of transactions. The attached file is only edited to remove personal details.
On request of developers, I can provide original file from bank.
It looks like, this is bug in ofx library:
$ ofxdump test.ofx
LibOFX INFO: libofx_proc_file(): File format not specified, autodecting...
(Above message occured on Line 18446744073709551615, Column 18446744073709551615)
LibOFX INFO: libofx_proc_file(): Detected file format: OFX (Open Financial eXchange (OFX or QFX))
(Above message occured on Line 18446744073709551615, Column 18446744073709551615)
LibOFX STATUS: find_dtd():DTD found: /usr/share/libofx4/0.9.0/dtd/opensp.dcl
(Above message occured on Line 18446744073709551615, Column 18446744073709551615)
LibOFX STATUS: find_dtd():DTD found: /usr/share/libofx4/0.9.0/dtd/ofx160.dtd
(Above message occured on Line 18446744073709551615, Column 18446744073709551615)
LibOFX INFO: Created OfxDummyContainer to hold unsupported aggregate SIGNONMSGSRSV1
(Above message occured on Line 2, Column 3)
LibOFX INFO: Created OfxDummyContainer to hold unsupported aggregate SONRS
(Above message occured on Line 3, Column 5)
ofx_proc_status():
Ofx entity this status is relevent to: SONRS
Severity: INFO
Code: 0, name: Success
Description: The server successfully processed the request.
LibOFX INFO: Created OfxDummyContainer to hold unsupported aggregate BANKMSGSRSV1
(Above message occured on Line 13, Column 3)
LibOFX INFO: Created OfxDummyContainer to hold unsupported aggregate STMTTRNRS
(Above message occured on Line 14, Column 5)
ofx_proc_status():
Ofx entity this status is relevent to: STMTTRNRS
Severity: INFO
Code: 0, name: Success
Description: The server successfully processed the request.
terminate called after throwing an instance of 'std::out_of_range'
what(): basic_string::substr
Aborted
Build libofx 0.9.1 from source to collect stack trace:
#0 0x00007ffff6888ba5 in raise (sig=<value optimized out>)
at ../nptl/sysdeps/unix/sysv/linux/raise.c:64
#1 0x00007ffff688c6b0 in abort () at abort.c:92
#2 0x00007ffff712c6bd in __gnu_cxx::__verbose_terminate_handler()
() from /usr/lib/libstdc++.so.6
#3 0x00007ffff712a906 in ?? () from /usr/lib/libstdc++.so.6
#4 0x00007ffff712a933 in std::terminate() ()
from /usr/lib/libstdc++.so.6
#5 0x00007ffff712aa3e in __cxa_throw ()
from /usr/lib/libstdc++.so.6
#6 0x00007ffff70d538e in std::__throw_out_of_range(char const*) ()
from /usr/lib/libstdc++.so.6
#7 0x00007ffff7bb31dd in ofxdate_to_time_t(std::basic_string<char, std::char_traits<char>, std::allocator<char> >) ()
from /usr/lib/libofx.so.4
#8 0x00007ffff7bbc36f in OfxStatementContainer::add_attribute(std::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::basic_string<char, std::char_traits<char>, std::allocator<char> >)
() from /usr/lib/libofx.so.4
#9 0x00007ffff7bbfe16 in OfxPushUpContainer::add_attribute(std::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::basic_string<char, std::char_traits<char>, std::allocator<char> >) ()
from /usr/lib/libofx.so.4
#10 0x00007ffff7bca799 in OFXApplication::endElement(SGMLApplication::EndElementEvent const&) () from /usr/lib/libofx.so.4
#11 0x00007ffff78a4842 in OpenSP::GenericEventHandler::endElement(OpenSP::EndElementEvent*) () from /usr/lib/libosp.so.5
#12 0x00007ffff7911e08 in OpenSP::Parser::acceptEndTag(OpenSP::EndElementEvent*) () from /usr/lib/libosp.so.5
#13 0x00007ffff7914d63 in OpenSP::Parser::doContent() ()
from /usr/lib/libosp.so.5
#14 0x00007ffff78bacf8 in OpenSP::Parser::parseAll(OpenSP::EventHandler&, int const volatile*) () from /usr/lib/libosp.so.5
#15 0x00007ffff78bdb0e in OpenSP::ParserApp::parseAll(OpenSP::SgmlParser&, OpenSP::EventHandler&, int const volatile*) ()
from /usr/lib/libosp.so.5
#16 0x00007ffff78bf161 in OpenSP::ParserEventGenerator::run(SGMLApplication&) () from /usr/lib/libosp.so.5
#17 0x00007ffff7bc9f92 in ofx_proc_sgml(LibofxContext*, int, char**)
() from /usr/lib/libofx.so.4
#18 0x00007ffff7bb6e57 in ofx_proc_file () from /usr/lib/libofx.so.4
#19 0x00007ffff7bb40ab in libofx_proc_file ()
from /usr/lib/libofx.so.4
#20 0x0000000000402a46 in main (argc=<value optimized out>,
argv=<value optimized out>) at ofxdump.cpp:436
It looks like, date in OFX files from my bank are not in correct format (w/o time), and libofx code is not written well for such case:
from lib/ofx_utilities.cpp:
if(ofxdate.size()>8) {
/* if exact time is specified */
exact_time_specified = true;
time.tm_hour=atoi(ofxdate.substr(8,2).c_str());
time.tm_min=atoi(ofxdate.substr(10,2).c_str());
time.tm_sec=atoi(ofxdate.substr(12,2).c_str());
}
Sample dates:
<DTSTART>201009099.9</DTSTART>
<DTEND>201009099.9.</DTEND>
As a workaround, will fix this dates by hand...
Hi Luka, Thank you for your analysis. The incident seems to be already opened in launchpad. https://bugs.launchpad.net/ubuntu/+source/libofx/+bug/661809 I close this incident because the problem must be closed in libOfx. Thank you for using Skrooge I will deliver a correction to catch libofx exceptions SVN commit 1189768 by smankowski: BUG: 255133: Skrooge crash on ofx import (With wrong data format. Bug in libOFX) M +1 -0 CHANGELOG M +2 -0 skgbankmodeler/CMakeLists.txt M +5 -0 skgbankmodeler/skgimportexportmanager.cpp M +14 -0 skgbankmodelertest/skgtestimportofx.cpp A tests/input/skgtestimportofx/exception.ofx WebSVN link: http://websvn.kde.org/?view=rev&revision=1189768 Fixed upstream, the sample file parses (but probably with the wrong date, it's unclear what to do generically with the extra 0.) |