diff options
author | Giuseppe D'Angelo <giuseppe.dangelo@kdab.com> | 2020-07-23 16:59:22 +0200 |
---|---|---|
committer | Giuseppe D'Angelo <giuseppe.dangelo@kdab.com> | 2020-07-27 23:02:33 +0200 |
commit | b71c8eb3864f36ba7bafce1fcb7c7caee67f4405 (patch) | |
tree | d5bf74165249f8cf307a3e5215cb21a721906882 /src/widgets/util | |
parent | a77c159044ce54fbdabaef088290771143ca5c2c (diff) |
QCompleter: fix an out of bounds access in a QMap
If the iterator points to the map's begin(), then one can't
decrement it. Split the check and the decrement.
Change-Id: I3d816f13d0bcacc8253ba6d223bc83c874e5efb5
Pick-to: 5.15
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Diffstat (limited to 'src/widgets/util')
-rw-r--r-- | src/widgets/util/qcompleter.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/widgets/util/qcompleter.cpp b/src/widgets/util/qcompleter.cpp index 7febc23b2d..b3833c5f50 100644 --- a/src/widgets/util/qcompleter.cpp +++ b/src/widgets/util/qcompleter.cpp @@ -587,7 +587,8 @@ QIndexMapper QSortedModelEngine::indexHint(QString part, const QModelIndex& pare const CacheItem::const_iterator it = map.lowerBound(part); // look backward for first valid hint - for(CacheItem::const_iterator it1 = it; it1-- != map.constBegin();) { + for (CacheItem::const_iterator it1 = it; it1 != map.constBegin();) { + --it1; const QMatchData& value = it1.value(); if (value.isValid()) { if (order == Qt::AscendingOrder) { |