Bug 263861

Summary: Crash in CSVPlugin, with invalid column selection
Product: [Applications] kmymoney Reporter: allan <agander93>
Component: generalAssignee: KMyMoney Devel Mailing List <kmymoney-devel>
Status: RESOLVED FIXED    
Severity: crash    
Priority: NOR    
Version First Reported In: SVN   
Target Milestone: ---   
Platform: openSUSE   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description allan 2011-01-21 12:58:11 UTC
Version:           SVN trunk (using KDE 4.5.85) 
OS:                Linux

When the plugin loads, it displays the column numbers saved from the last file. If the user imports the new file without noticing that those saved selections are not valid for his file, a crash may occur because of an invalid index.

When the plugin loads the values from the rc file, the values are checked to be in range (1 to MAXCOL value (14)), and the relevant fields are flagged as present.  During import, these flags are checked to ensure the vital fields are present, and the import proceeds.  Now, it might be found that the new file has fewer columns than the previous file, and that one or more of the columns flagged as being present, are not now present.  The scan of the columns was using an incorrect range, potentially allowing a valid field type to be detected in an invalid column, resulting in the crash.

The range for column checking has been corrected, and additional checks added that the vital fields are present in the new file, and not just remembered from the previous file. 

Reproducible: Always

Steps to Reproduce:
Load a file having several columns, then exit, so the column values are saved to the rc file.  Then load another file having fewer columns, and import it without selecting appropriate columns.  If the column numbers saved from the first file are outside the scope of the new file, KMM will crash.

Actual Results:  
KMM will crash.

Expected Results:  
The users oversight should be detected, and the problem avoided.

A patch will be entered in Reviewboard. (http://svn.reviewboard.kde.org/r/6394/)
Comment 1 allan 2011-01-25 17:49:37 UTC
svn 1217077 committed after consultation on list.