Bug 415548

Summary: The character < as part of a matched transaction which was imported causes load to fail
Product: [Applications] kmymoney Reporter: Thomas Baumgart <tbaumgart>
Component: fileAssignee: KMyMoney Devel Mailing List <kmymoney-devel>
Status: RESOLVED FIXED    
Severity: normal    
Priority: NOR    
Version: 5.0.7   
Target Milestone: ---   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed In: 5.0.8
Sentry Crash Report:

Description Thomas Baumgart 2019-12-25 09:46:36 UTC
SUMMARY
If an imported transaction contains the character < with some following text (thus looking like an XML tag) as part of the memo field and this transaction is matched against another one on file but not accepted and the file is saved in this state it cannot be loaded anymore.

STEPS TO REPRODUCE
1. Create a sample file with two accounts A and B
2. Create a transaction from account A to B and the text "TEST <TEST" as memo (w/o the quotes)
3. Save the file as XML
4. Modify the transaction in an editor to have the transaction memo attribute the contents of the split memo attribute and save the file
  (this is what the state after import is)
5. Restart KMyMoney
6. Duplicate the transaction
7. Select both and match them
8. Save the file
9. Reload the file -> Boom

OBSERVED RESULT
File fails to load

EXPECTED RESULT
File is loaded without data loss

ADDITIONAL INFORMATION
If you skip steps 3..5 above one can load the file but information about the matched transaction is lost. The cause is the same: escaping of XML content does not work properly.

This has first been reported on https://forum.kde.org/viewtopic.php?f=69&t=163735
Comment 1 Thomas Baumgart 2019-12-25 15:53:36 UTC
Git commit 2ce69c0aa4133714804231e587f196b808eaa3d0 by Thomas Baumgart.
Committed on 25/12/2019 at 15:53.
Pushed by tbaumgart into branch '5.0'.

Fix storage of matched transaction containing a the character <

A problem occured if a matched transaction contained the character 'less
than' (<). This change eliminates this problem. It does not affect
already stored transasction which have to be modified manually.
FIXED-IN: 5.0.8

M  +2    -2    kmymoney/plugins/xml/mymoneystoragexml.cpp

https://commits.kde.org/kmymoney/2ce69c0aa4133714804231e587f196b808eaa3d0
Comment 2 Thomas Baumgart 2019-12-25 15:55:03 UTC
Git commit e529e3124d19c082acd71cf41b9488efe8a6ee6a by Thomas Baumgart.
Committed on 25/12/2019 at 15:54.
Pushed by tbaumgart into branch 'master'.

Fix storage of matched transaction containing a the character <

A problem occured if a matched transaction contained the character 'less
than' (<). This change eliminates this problem. It does not affect
already stored transasction which have to be modified manually.
FIXED-IN: 5.0.8
(cherry picked from commit 2ce69c0aa4133714804231e587f196b808eaa3d0)

M  +2    -2    kmymoney/plugins/xml/mymoneystoragexml.cpp

https://commits.kde.org/kmymoney/e529e3124d19c082acd71cf41b9488efe8a6ee6a