Bug 421900 - SEGFAULT occurring when marking an account as preferred
Summary: SEGFAULT occurring when marking an account as preferred
Status: RESOLVED FIXED
Alias: None
Product: kmymoney
Classification: Unclassified
Component: general (show other bugs)
Version: git (master)
Platform: Manjaro Linux
: NOR normal (vote)
Target Milestone: ---
Assignee: KMyMoney Devel Mailing List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-05-22 06:52 UTC by Robert Szczesiak
Modified: 2020-06-05 04:06 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In: 5.1.0


Attachments
Sample KMM file (1.13 KB, application/x-kmymoney)
2020-05-22 12:10 UTC, Robert Szczesiak
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Robert Szczesiak 2020-05-22 06:52:12 UTC
SUMMARY
Segmentation fault occurs when the user adds or edits an account with 'Preferred Account' checkbox checked.

STEPS TO REPRODUCE
1. Go to the Accounts view.
2. Right-click any of your accounts and select "Edit account..." option from the context menu.
3. Check "Preferred Account" and click the OK button.

OBSERVED RESULT
KMM suddenly crashes.

EXPECTED RESULT
The editted account should be added to the Favorites category in the Accounts view. 

SOFTWARE/OS VERSIONS
KDE Plasma Version: 5.18.4
KDE Frameworks Version: 5.70.0
Qt Version: 5.14.2
Comment 1 Robert Szczesiak 2020-05-22 12:10:05 UTC
Please find attached a sample KMM file in case you could not reproduce the issue on your file.
Comment 2 Robert Szczesiak 2020-05-22 12:10:25 UTC
Created attachment 128689 [details]
Sample KMM file
Comment 3 Robert Szczesiak 2020-05-22 12:57:00 UTC
Please find below a few last lines of `valgrind -v kmymoney`'s output:
reading file
start parsing file
startDocument
reading securities
endDocument
Cost center model created with items 0
Payees model created with items 0
==107338== Warning: set address range perms: large range [0x59c99000, 0x99c9b000) (noaccess)
--107338-- REDIR: 0xa13c250 (libc.so.6:malloc_usable_size) redirected to 0x483c160 (malloc_usable_size)
--107338-- Discarding syms at 0x0-0x0 in /usr/lib/qt/plugins/bearer/libqnmbearer.so (have_dinfo 0)
--107338-- Discarding syms at 0x0-0x0 in /usr/lib/qt/plugins/bearer/libqgenericbearer.so (have_dinfo 0)
--107338-- Discarding syms at 0x0-0x0 in /usr/lib/qt/plugins/sensors/libqtsensors_iio-sensor-proxy.so (have_dinfo 0)
--107338-- Reading syms from /usr/lib/qt/plugins/bearer/libqconnmanbearer.so
--107338--    object doesn't have a symbol table
--107338-- Reading syms from /usr/lib/qt/plugins/bearer/libqgenericbearer.so
--107338--    object doesn't have a symbol table
--107338-- Discarding syms at 0x0-0x0 in /usr/lib/qt/plugins/kmymoney/kcm_qif.so (have_dinfo 0)
--107338-- Reading syms from /usr/lib/qt/plugins/bearer/libqnmbearer.so
--107338--    object doesn't have a symbol table
--107338-- memcheck GC: 11801 nodes, 5583 survivors (47.3%)
--107338-- memcheck GC: 11978 new table size (driftup)
--107338-- WARNING: Serious error when reading debug info
--107338-- When reading debug info from /memfd:xorg (deleted):
--107338-- failed to stat64/stat this file
--107338-- WARNING: Serious error when reading debug info
--107338-- When reading debug info from /memfd:xorg (deleted):
--107338-- failed to stat64/stat this file
--107338-- memcheck GC: 11978 nodes, 5236 survivors (43.7%)
--107338-- memcheck GC: 12157 new table size (driftup)
--107338-- memcheck GC: 12157 nodes, 5258 survivors (43.3%)
--107338-- memcheck GC: 12339 new table size (driftup)
--107338-- WARNING: Serious error when reading debug info
--107338-- When reading debug info from /memfd:xorg (deleted):
--107338-- failed to stat64/stat this file
--107338-- memcheck GC: 12339 nodes, 6437 survivors (52.2%)
--107338-- memcheck GC: 17449 new table size (stepup)
--107338-- WARNING: Serious error when reading debug info
--107338-- When reading debug info from /memfd:xorg (deleted):
--107338-- failed to stat64/stat this file
--107338-- memcheck GC: 17449 nodes, 7038 survivors (40.3%)
--107338-- memcheck GC: 17710 new table size (driftup)
==107338== Stack overflow in thread #1: can't grow stack to 0x1ffe801000
==107338== 
==107338== Process terminating with default action of signal 11 (SIGSEGV): dumping core
==107338==  Access not within mapped region at address 0x1FFE801FF8
==107338== Stack overflow in thread #1: can't grow stack to 0x1ffe801000
==107338==    at 0x936144D: QStandardItemModel::index(int, int, QModelIndex const&) const (in /usr/lib/libQt5Gui.so.5.14.2)
==107338==  If you believe this happened as a result of a stack
==107338==  overflow in your program's main thread (unlikely but
==107338==  possible), you can try to increase the size of the
==107338==  main thread stack using the --main-stacksize= flag.
==107338==  The main thread stack size used in this run was 8388608.
==107338== Stack overflow in thread #1: can't grow stack to 0x1ffe801000
==107338== 
==107338== Process terminating with default action of signal 11 (SIGSEGV)
==107338==  Access not within mapped region at address 0x1FFE801FF0
==107338== Stack overflow in thread #1: can't grow stack to 0x1ffe801000
==107338==    at 0x482F120: _vgnU_freeres (vg_preloaded.c:59)
==107338==  If you believe this happened as a result of a stack
==107338==  overflow in your program's main thread (unlikely but
==107338==  possible), you can try to increase the size of the
==107338==  main thread stack using the --main-stacksize= flag.
==107338==  The main thread stack size used in this run was 8388608.
==107338== 
==107338== HEAP SUMMARY:
==107338==     in use at exit: 21,950,144 bytes in 103,107 blocks
==107338==   total heap usage: 509,337 allocs, 406,230 frees, 13,825,368,185 bytes allocated
==107338== 
==107338== Searching for pointers to 103,107 not-freed blocks
==107338== Checked 132,788,576 bytes
==107338== 
==107338== LEAK SUMMARY:
==107338==    definitely lost: 1,296 bytes in 6 blocks
==107338==    indirectly lost: 58,016 bytes in 359 blocks
==107338==      possibly lost: 401,414 bytes in 486 blocks
==107338==    still reachable: 21,489,418 bytes in 102,256 blocks
==107338==                       of which reachable via heuristic:
==107338==                         newarray           : 6,440 bytes in 34 blocks
==107338==                         multipleinheritance: 69,696 bytes in 104 blocks
==107338==         suppressed: 0 bytes in 0 blocks
==107338== Rerun with --leak-check=full to see details of leaked memory
==107338== 
==107338== ERROR SUMMARY: 4 errors from 1 contexts (suppressed: 0 from 0)
==107338== 
==107338== 4 errors in context 1 of 1:
==107338== Syscall param ioctl(generic) points to unaddressable byte(s)
==107338==    at 0xA1A62EB: ioctl (in /usr/lib/libc-2.31.so)
==107338==    by 0x999C013: ??? (in /usr/lib/libQt5Core.so.5.14.2)
==107338==    by 0x9931009: QFile::copy(QString const&) (in /usr/lib/libQt5Core.so.5.14.2)
==107338==    by 0x9931794: QFile::copy(QString const&, QString const&) (in /usr/lib/libQt5Core.so.5.14.2)
==107338==    by 0x1D964F: ??? (in /usr/bin/kmymoney)
==107338==    by 0x1DBCFC: ??? (in /usr/bin/kmymoney)
==107338==    by 0x1C4EA9: ??? (in /usr/bin/kmymoney)
==107338==    by 0xA0D7022: (below main) (in /usr/lib/libc-2.31.so)
==107338==  Address 0xb is not stack'd, malloc'd or (recently) free'd
==107338== 
==107338== ERROR SUMMARY: 4 errors from 1 contexts (suppressed: 0 from 0)
[1]    107338 segmentation fault (core dumped)  valgrind -v kmymoney
Comment 4 Thomas Baumgart 2020-05-22 18:10:40 UTC
Git commit 13f50ceebd72bf4e23a633f3c6e052a26e44581d by Thomas Baumgart, on behalf of Robert Szczesiak.
Committed on 22/05/2020 at 18:10.
Pushed by tbaumgart into branch 'master'.

Fix SEGFAULT occurring when marking an account as preferred

Segmentation fault occurred when the user added or edited an account
with "Preferred Account" checkbox checked.

This commit solves the issue so that the user can add/remove preferred
accounts from Favorites without encountering SEGFAULT.
Signed-off-by: Robert Szczesiak <dev.rszczesiak@gmail.com>

M  +8    -7    kmymoney/models/accountsmodel.cpp

https://invent.kde.org/office/kmymoney/commit/13f50ceebd72bf4e23a633f3c6e052a26e44581d
Comment 5 Thomas Baumgart 2020-05-22 18:18:37 UTC
Git commit 70b48c8da2499f33665574ad7b47fdb8d270893a by Thomas Baumgart.
Committed on 22/05/2020 at 18:18.
Pushed by tbaumgart into branch '5.0'.

Fix SEGFAULT occurring when marking an account as preferred

Segmentation fault occurred when the user added or edited an account
with "Preferred Account" checkbox checked.

This commit solves the issue so that the user can add/remove preferred
accounts from Favorites without encountering SEGFAULT.
FIXED-IN: 5.0.9

Signed-off-by: Robert Szczesiak <dev.rszczesiak@gmail.com>
(cherry picked from commit 13f50ceebd72bf4e23a633f3c6e052a26e44581d)

M  +8    -7    kmymoney/models/accountsmodel.cpp

https://invent.kde.org/office/kmymoney/commit/70b48c8da2499f33665574ad7b47fdb8d270893a