Bug 408026

Summary: Crash during CSV import
Product: [Applications] kmymoney Reporter: Thomas Baumgart <tbaumgart>
Component: importerAssignee: KMyMoney Devel Mailing List <kmymoney-devel>
Status: RESOLVED FIXED    
Severity: normal    
Priority: NOR    
Version: 5.0.4   
Target Milestone: ---   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed In: 5.0.5
Sentry Crash Report:

Description Thomas Baumgart 2019-05-28 11:38:26 UTC
SUMMARY
When switching CSV profiles KMyMoney may crash during next import

STEPS TO REPRODUCE
1. Import CSV file with profile that contains a number column assignment of e.g. 6
2. Import CSV file with the same profile where the file only has 3 columns and re-assign the columns (number not assigned)

OBSERVED RESULT
KMyMoney crashes during import.

EXPECTED RESULT
KMyMoney should import the file w/o crash

ADDITIONAL INFORMATION
The problem is, that the index for the UI is handled correctly, but the column assignment in the underlying profile still contains the old column assignment of 6 which produces a value out of bounds.
Comment 1 Thomas Baumgart 2019-05-28 11:52:45 UTC
Git commit 09fc41b4b872e0a5ec4ce2b955f99c04ae975d91 by Thomas Baumgart.
Committed on 28/05/2019 at 11:52.
Pushed by tbaumgart into branch '5.0'.

Reset column assignment when out of bounds

In case the column assignment is cleared using the clear all button, the
profile is not updated because there is no change in index in combobox
widget and the connected slot for profile update will never be called.

This change makes sure that in such a case (previous assignment is out
of bounds for the current file) the assignment is reset before it is
used. This avoids the out-of-bounds crash later on.
FIXED-IN: 5.0.5

M  +5    -0    kmymoney/plugins/csv/import/bankingwizardpage.cpp

https://commits.kde.org/kmymoney/09fc41b4b872e0a5ec4ce2b955f99c04ae975d91