diff options
| author | Marc Mutz <marc.mutz@qt.io> | 2024-03-25 18:26:16 +0100 |
|---|---|---|
| committer | Marc Mutz <marc.mutz@qt.io> | 2024-03-26 11:26:24 +0100 |
| commit | 19aeb431cf1bd4e864356ff02db6337dc59b2835 (patch) | |
| tree | 568d8e681ebdb4ce1dbdeb69a6fb3acb6e7e1b19 /src/corelib/serialization/qjsonarray.cpp | |
| parent | 0281005a711c3635114ba92f778d0e9c8a89027d (diff) | |
QMainWindowLayout: rewrite validateToolBarArea() to return by value
Coverity complains that QToolBarAreaLayout's
addToolBarBreak(QInternal::DockPosition) could access
QToolBarAreaLayout::docks out of bounds if passed
QInternal::DockCount.
That is correct, but a valid pos seems to be a precondition for this
function, judging from its sister functions, e.g.
addToolBar(DockPosition, .) or insertItem(DockPosition, .), which also
don't validate `pos`. All in-module callers of addToolBarBreak() only
pass valid positions, and use validateToolBarArea() to ensure that. So
it seems that Coverity doesn't grok the pass-by-in/out -parameter used
by that function. That, or it doesn't track back far enough.
Before attempting more drastic measures, first try rewriting the
function to return-by-value instead, and see what Coverity has to say
afterwards.
As a drive-by, make validateToolBarArea() constexpr.
Pick-to: 6.7 6.6 6.5 6.2 5.15
Coverity-Id: 444141
Coverity-Id: 444135
Change-Id: I5fcc664c3cea608429036cad75c37f5c38059733
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
Diffstat (limited to 'src/corelib/serialization/qjsonarray.cpp')
0 files changed, 0 insertions, 0 deletions
