Bug 441132 - Crash when filtering on a time range
Summary: Crash when filtering on a time range
Status: RESOLVED FIXED
Alias: None
Product: Heaptrack
Classification: Applications
Component: general (other bugs)
Version First Reported In: unspecified
Platform: Compiled Sources Linux
: NOR crash
Target Milestone: ---
Assignee: Milian Wolff
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-08-18 14:36 UTC by David Faure
Modified: 2021-08-19 06:49 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed/Implemented In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description David Faure 2021-08-18 14:36:01 UTC
SUMMARY

$ heaptrack -a /home/dfaure/heaptrack.akonadiserver.14228.zst 

(some old file I had lying around, in case it matters)

Filtered for a time range (around the first 10 to 20% of the recording)

OBSERVED RESULT

FATAL: ASSERT: "m_data.labels.size() < ChartRows::MAX_NUM_COST" in file /d/kde/src/5/extragear/sdk/heaptrack/src/analyze/gui/chartmodel.cpp, line 181

EXPECTED RESULT

Keine assert :-)

SOFTWARE/OS VERSIONS
Linux: OpenSUSE Tumbleweed snapshot 20210810
Heaptrack: git master from today (2a1e071)
Qt Version: 5.15.3-kde
Comment 1 David Faure 2021-08-18 14:41:55 UTC
(gdb) p m_data.labels.d->size
$5 = 20
(gdb) p (int) ChartRows::MAX_NUM_COST
$7 = 20
Comment 2 David Faure 2021-08-18 14:43:47 UTC
178│ void ChartModel::resetData(const ChartData& data)
179│ {
180│     Q_ASSERT(data.resultData);
181├───> Q_ASSERT(m_data.labels.size() < ChartRows::MAX_NUM_COST);
182│     beginResetModel();
183│     m_data = data;

Was this means to be an assert on data rather m_data? It seems odd to test the old data we're about to replace....
Comment 3 Milian Wolff 2021-08-19 06:49:42 UTC
Git commit b9e2f195909871608842d18db071296263b84d7a by Milian Wolff.
Committed on 19/08/2021 at 06:46.
Pushed by mwolff into branch 'master'.

Fix latent bug in ChartData creation

We created too many labeled values, leading to an overflow
of the ChartRows::cost array. Previously, this assert didn't
hit until filtering, because the model checked the size of the
wrong container.

This patch fixes this all: We now ensure we stay within
ChartRows::MAX_NUM_COST but also increase it by one to keep the
same size as before. Furthermore, we now correctly assert the size
of the right container, and additionally check this already during
parsing and not only later when the model is set.

M  +1    -1    src/analyze/gui/chartmodel.cpp
M  +1    -1    src/analyze/gui/chartmodel.h
M  +2    -1    src/analyze/gui/parser.cpp

https://invent.kde.org/sdk/heaptrack/commit/b9e2f195909871608842d18db071296263b84d7a