Bug 374526 - Seg fault when import ofx file
Summary: Seg fault when import ofx file
Status: RESOLVED FIXED
Alias: None
Product: kmymoney
Classification: Applications
Component: general (show other bugs)
Version: 4.8.0
Platform: Compiled Sources Linux
: NOR normal
Target Milestone: ---
Assignee: KMyMoney Devel Mailing List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-01-04 08:08 UTC by Alexandre
Modified: 2019-08-31 07:59 UTC (History)
3 users (show)

See Also:
Latest Commit:
Version Fixed In: 4.8.1,5.0.0
Sentry Crash Report:
ralf.habacker: Backport+


Attachments
patch file that fixes seg fault on KMyMoneyApp::account (1.66 KB, patch)
2017-01-04 08:08 UTC, Alexandre
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Alexandre 2017-01-04 08:08:46 UTC
Created attachment 103186 [details]
patch file that fixes seg fault on KMyMoneyApp::account

The current version on Github (commit 5ecbe8f8a74fbf14fbbac06ea418731aa51d884c) seg faults when importing an ofx file. I traced the problem to the function KMyMoneyApp::account in the file kmymoney.cpp. The following patch fixes that, it seems that something get destroyed when the function returns getting a seg fault on the QString Qt code.
Comment 1 wojnilowicz 2017-07-30 06:48:46 UTC
Could you attach crashing OFX file?
Comment 2 Thomas Baumgart 2017-07-30 10:26:34 UTC
The problem is caused by the usage of the returned reference, which in some cases could be already invalid (when it references the local accList object which gets destroyed upon return).

I'll take care of that in master. Maybe a backport to 4.8 is not a bad idea either.
Comment 3 Thomas Baumgart 2017-07-30 10:27:05 UTC
Git commit 0d069938cfe325bb4cca28bfde5432a49ab8cbf8 by Thomas Baumgart.
Committed on 30/07/2017 at 10:19.
Pushed by tbaumgart into branch 'master'.

Fix reference to object after destruction

The returned reference to the object could be deleted in the case the
account was kept in the local list. This patch makes sure the returned
reference always references an object in the object container where
the objects reside.
FIXED-IN: 5.0

M  +8    -10   kmymoney/kmymoney.cpp

https://commits.kde.org/kmymoney/0d069938cfe325bb4cca28bfde5432a49ab8cbf8
Comment 4 Ralf Habacker 2017-07-30 15:23:36 UTC
Git commit a0ae7c05f9f5bae48c737a2f7a9bcfb77468fc39 by Ralf Habacker, on behalf of Thomas Baumgart.
Committed on 30/07/2017 at 15:22.
Pushed by habacker into branch '4.8'.

Fix reference to object after destruction

The returned reference to the object could be deleted in the case the
account was kept in the local list. This patch makes sure the returned
reference always references an object in the object container where
the objects reside.
FIXED-IN: 4.8.1
(cherry picked from commit 0d069938cfe325bb4cca28bfde5432a49ab8cbf8)

M  +8    -10   kmymoney/kmymoney.cpp

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