Bug 314940

Summary: Crash in CSV importer due to too much columns in CSV file (e.g. paypal CVS files)
Product: [Applications] kmymoney Reporter: Ian Hubbertz <kde_bugs>
Component: generalAssignee: KMyMoney Devel Mailing List <kmymoney-devel>
Status: RESOLVED FIXED    
Severity: crash CC: agander93, kde_bugs, onet.cristian
Priority: NOR    
Version: 4.6.3   
Target Milestone: ---   
Platform: Ubuntu   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:
Attachments: New crash information added by DrKonqi

Description Ian Hubbertz 2013-02-11 22:13:42 UTC
Application: kmymoney (4.6.3)
KDE Platform Version: 4.9.3
Qt Version: 4.8.3
Operating System: Linux 3.5.0-21-generic x86_64
Distribution: Ubuntu 12.10

-- Information about the crash:
- What I was doing when the application crashed:
Trynng to import a CSV file from paypal.

The importer always crashs at the moment I'm setting a column. I tried the "amount" column (changing it from '6' (last succesful import) to '8') and the "date" column  (changing it from '2' (last successful import) to '1'). Immediately after the change, the importer segfaults.

The crash can be reproduced every time.

-- Backtrace:
Application: KMyMoney (kmymoney), signal: Segmentation fault
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
[Current thread is 1 (Thread 0x7f0f9f263780 (LWP 5524))]

Thread 3 (Thread 0x7f0f86ce1700 (LWP 5525)):
#0  0x00007f0f94e658fd in ?? () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#1  0x00007f0f94e67597 in g_main_context_prepare () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#2  0x00007f0f94e67cab in ?? () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#3  0x00007f0f94e67ea4 in g_main_context_iteration () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#4  0x00007f0f9b345c16 in QEventDispatcherGlib::processEvents (this=0x7f0f800008c0, flags=...) at kernel/qeventdispatcher_glib.cpp:426
#5  0x00007f0f9b3162bf in QEventLoop::processEvents (this=this@entry=0x7f0f86ce0dd0, flags=...) at kernel/qeventloop.cpp:149
#6  0x00007f0f9b316548 in QEventLoop::exec (this=0x7f0f86ce0dd0, flags=...) at kernel/qeventloop.cpp:204
#7  0x00007f0f9b217b10 in QThread::exec (this=<optimized out>) at thread/qthread.cpp:501
#8  0x00007f0f9b2f69af in QInotifyFileSystemWatcherEngine::run (this=0x32d6f40) at io/qfilesystemwatcher_inotify.cpp:248
#9  0x00007f0f9b21aaec in QThreadPrivate::start (arg=0x32d6f40) at thread/qthread_unix.cpp:338
#10 0x00007f0f9c451e9a in start_thread () from /lib/x86_64-linux-gnu/libpthread.so.0
#11 0x00007f0f99797cbd in clone () from /lib/x86_64-linux-gnu/libc.so.6
#12 0x0000000000000000 in ?? ()

Thread 2 (Thread 0x7f0f7c637700 (LWP 5531)):
#0  0x00007f0f9978c303 in poll () from /lib/x86_64-linux-gnu/libc.so.6
#1  0x00007f0f94e67d84 in ?? () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#2  0x00007f0f94e67ea4 in g_main_context_iteration () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#3  0x00007f0f9b345c16 in QEventDispatcherGlib::processEvents (this=0x7f0f740008c0, flags=...) at kernel/qeventdispatcher_glib.cpp:426
#4  0x00007f0f9b3162bf in QEventLoop::processEvents (this=this@entry=0x7f0f7c636dd0, flags=...) at kernel/qeventloop.cpp:149
#5  0x00007f0f9b316548 in QEventLoop::exec (this=0x7f0f7c636dd0, flags=...) at kernel/qeventloop.cpp:204
#6  0x00007f0f9b217b10 in QThread::exec (this=<optimized out>) at thread/qthread.cpp:501
#7  0x00007f0f9b2f69af in QInotifyFileSystemWatcherEngine::run (this=0x5b94ca0) at io/qfilesystemwatcher_inotify.cpp:248
#8  0x00007f0f9b21aaec in QThreadPrivate::start (arg=0x5b94ca0) at thread/qthread_unix.cpp:338
#9  0x00007f0f9c451e9a in start_thread () from /lib/x86_64-linux-gnu/libpthread.so.0
#10 0x00007f0f99797cbd in clone () from /lib/x86_64-linux-gnu/libc.so.6
#11 0x0000000000000000 in ?? ()

Thread 1 (Thread 0x7f0f9f263780 (LWP 5524)):
[KCrash Handler]
#5  0x00007f0f9b25f936 in QString::operator== (this=0x5871fa0, other=...) at tools/qstring.cpp:2192
#6  0x00007f0f7fbab08d in CsvImporterDlg::validateColumn (this=this@entry=0x5871b70, col=@0x7fff55431e0c: 0, type=...) at /build/buildd/kmymoney-4.6.3/kmymoney/plugins/csvimport/csvimporterdlg.cpp:265
#7  0x00007f0f7fbab4d0 in CsvImporterDlg::dateColumnSelected (this=0x5871b70, col=0) at /build/buildd/kmymoney-4.6.3/kmymoney/plugins/csvimport/csvimporterdlg.cpp:381
#8  0x00007f0f9b32cf5f in QMetaObject::activate (sender=0x58cbf90, m=<optimized out>, local_signal_index=<optimized out>, argv=0x7fff55431f70) at kernel/qobject.cpp:3547
#9  0x00007f0f9a81a5f1 in QComboBox::currentIndexChanged (this=this@entry=0x58cbf90, _t1=0) at .moc/release-shared/moc_qcombobox.cpp:316
#10 0x00007f0f9a81a657 in QComboBoxPrivate::_q_emitCurrentIndexChanged (this=this@entry=0x58cbfe0, index=...) at widgets/qcombobox.cpp:1278
#11 0x00007f0f9a81a860 in QComboBoxPrivate::setCurrentIndex (this=this@entry=0x58cbfe0, mi=...) at widgets/qcombobox.cpp:2046
#12 0x00007f0f9a81b4f4 in QComboBoxPrivate::_q_itemSelected (this=0x58cbfe0, item=...) at widgets/qcombobox.cpp:1247
#13 0x00007f0f9b32cf5f in QMetaObject::activate (sender=0x58d33e0, m=<optimized out>, local_signal_index=<optimized out>, argv=0x7fff554321e0) at kernel/qobject.cpp:3547
#14 0x00007f0f9aaaf482 in QComboBoxPrivateContainer::itemSelected (this=<optimized out>, _t1=...) at .moc/release-shared/moc_qcombobox_p.cpp:253
#15 0x00007f0f9a815b77 in QComboBoxPrivateContainer::eventFilter (this=0x58d33e0, o=0x58cdd30, e=0x7fff55432930) at widgets/qcombobox.cpp:691
#16 0x00007f0f9b3176d6 in QCoreApplicationPrivate::sendThroughObjectEventFilters (this=<optimized out>, receiver=0x58cdd30, event=0x7fff55432930) at kernel/qcoreapplication.cpp:1025
#17 0x00007f0f9a443e6c in QApplicationPrivate::notify_helper (this=this@entry=0x2aba0b0, receiver=receiver@entry=0x58cdd30, e=e@entry=0x7fff55432930) at kernel/qapplication.cpp:4558
#18 0x00007f0f9a448b6b in QApplication::notify (this=<optimized out>, receiver=0x58cdd30, e=0x7fff55432930) at kernel/qapplication.cpp:4105
#19 0x00007f0f9d8c21d6 in KApplication::notify(QObject*, QEvent*) () from /usr/lib/libkdeui.so.5
#20 0x00007f0f9b31756e in QCoreApplication::notifyInternal (this=0x2aad7e0, receiver=0x58cdd30, event=0x7fff55432930) at kernel/qcoreapplication.cpp:915
#21 0x00007f0f9a444cd3 in sendEvent (event=<optimized out>, receiver=<optimized out>) at ../../include/QtCore/../../src/corelib/kernel/qcoreapplication.h:231
#22 QApplicationPrivate::sendMouseEvent (receiver=0x58cdd30, event=0x7fff55432930, alienWidget=0x58cdd30, nativeWidget=0x58d33e0, buttonDown=0x7f0f9af20308 <qt_button_down>, lastMouseReceiver=..., spontaneous=true) at kernel/qapplication.cpp:3173
#23 0x00007f0f9a4c241c in QETWidget::translateMouseEvent (this=this@entry=0x58d33e0, event=event@entry=0x7fff554330b0) at kernel/qapplication_x11.cpp:4556
#24 0x00007f0f9a4c144f in QApplication::x11ProcessEvent (this=0x2aad7e0, event=0x7fff554330b0) at kernel/qapplication_x11.cpp:3737
#25 0x00007f0f9a4e8fa2 in x11EventSourceDispatch (s=0x2ac2990, callback=0x0, user_data=0x0) at kernel/qguieventdispatcher_glib.cpp:146
#26 0x00007f0f94e67ab5 in g_main_context_dispatch () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#27 0x00007f0f94e67de8 in ?? () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#28 0x00007f0f94e67ea4 in g_main_context_iteration () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#29 0x00007f0f9b345bf6 in QEventDispatcherGlib::processEvents (this=0x2a86ad0, flags=...) at kernel/qeventdispatcher_glib.cpp:424
#30 0x00007f0f9a4e8c1e in QGuiEventDispatcherGlib::processEvents (this=<optimized out>, flags=...) at kernel/qguieventdispatcher_glib.cpp:204
#31 0x00007f0f9b3162bf in QEventLoop::processEvents (this=this@entry=0x7fff55433480, flags=...) at kernel/qeventloop.cpp:149
#32 0x00007f0f9b316548 in QEventLoop::exec (this=0x7fff55433480, flags=...) at kernel/qeventloop.cpp:204
#33 0x00007f0f9b31b708 in QCoreApplication::exec () at kernel/qcoreapplication.cpp:1187
#34 0x0000000000457dd6 in runKMyMoney (splash=splash@entry=0x2bee800, a=0x2aad7e0) at /build/buildd/kmymoney-4.6.3/kmymoney/main.cpp:282
#35 0x000000000045659f in main (argc=1, argv=0x7fff55433f78) at /build/buildd/kmymoney-4.6.3/kmymoney/main.cpp:181

Reported using DrKonqi
Comment 1 Ian Hubbertz 2013-02-11 22:17:18 UTC
Created attachment 77173 [details]
New crash information added by DrKonqi

kmymoney (4.6.3) on KDE Platform 4.9.3 using Qt 4.8.3

- What I was doing when the application crashed:

Same crash, now with setting the amount column to value '8' (seems to be col=7 in backtrace) instead of date column to value '1'  (col=0 in BT) as in the previous backtrace.

-- Backtrace (Reduced):
#5  0x00007f7f4f887936 in QString::operator== (this=0x46047a0, other=...) at tools/qstring.cpp:2192
#6  0x00007f7f3824208d in CsvImporterDlg::validateColumn (this=this@entry=0x4604370, col=@0x7fff94121f1c: 7, type=...) at /build/buildd/kmymoney-4.6.3/kmymoney/plugins/csvimport/csvimporterdlg.cpp:265
#7  0x00007f7f38242860 in CsvImporterDlg::amountColumnSelected (this=0x4604370, col=7) at /build/buildd/kmymoney-4.6.3/kmymoney/plugins/csvimport/csvimporterdlg.cpp:288
[...]
#9  0x00007f7f4ee425f1 in QComboBox::currentIndexChanged (this=this@entry=0x46a4eb0, _t1=7) at .moc/release-shared/moc_qcombobox.cpp:316
#10 0x00007f7f4ee42657 in QComboBoxPrivate::_q_emitCurrentIndexChanged (this=this@entry=0x46a4f00, index=...) at widgets/qcombobox.cpp:1278
Comment 2 Ian Hubbertz 2013-02-11 22:41:35 UTC
Haha.. found it.

csvprocessing.h:41

#define MAXCOL 25    //                 maximum no. of columns (arbitrary value)


Seems that this value is not large enough for paypal CSV files...
Comment 3 allan 2013-02-11 23:50:45 UTC
(In reply to comment #2)
> Haha.. found it.
> 
> csvprocessing.h:41
> 
> #define MAXCOL 25    //                 maximum no. of columns (arbitrary
> value)
> 
> 
> Seems that this value is not large enough for paypal CSV files...

OK.  Well spotted.  Snag is, that file is not part of kmymoney (4.6.3).  So, the question is, where did it come from?

It might be that it's a relic of 4.6.2, which was not uninstalled, and the old plugin is still in your system.  In what style does the plugin appear?  Is it the tabs version or the wizard?  Have you compiled from source, or was it a deb you had previously?
Comment 4 Ian Hubbertz 2013-02-12 09:24:46 UTC
In 4.6.3 the file is still in use, see

https://projects.kde.org/projects/extragear/office/kmymoney/repository/show/kmymoney/plugins/csvimport?rev=4.6.3

Does the new importer in the master branch allow more columns?


BTW: As workaround for the problem it is possible to select the columns at the paypal site before CSV export and reduce the number of colums to less than 20.
Comment 5 allan 2013-02-12 11:39:39 UTC
(In reply to comment #4)
> In 4.6.3 the file is still in use, see

Apologies, a slip of the tongue.  The problem was fixed last August, in the development release.  That too involved a Paypal file.  It's likely that 4.6.4 will soon be released.

> https://projects.kde.org/projects/extragear/office/kmymoney/repository/show/
> kmymoney/plugins/csvimport?rev=4.6.3

> Does the new importer in the master branch allow more columns?

Yes, there is no longer a hard-coded limit.

> 
> BTW: As workaround for the problem it is possible to select the columns at
> the paypal site before CSV export and reduce the number of colums to less
> than 20.

That's handy.
Comment 6 Cristian OneČ› 2013-08-30 08:13:21 UTC
Fixed in master as stated by Allan.