Avoid potential read of uninitialized clip data

Set clip->count to 0 unconditional not just when hasRegionClip or
hasRectClip is true.

Pick-to: 6.1
Change-Id: Ib3d1c4dc24373df3d4dbc393241226a8730bb9fc
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
bb10
Allan Sandfeld Jensen 2021-05-11 15:52:23 +02:00
parent f5c69a5195
commit 9d2850bda9
1 changed files with 1 additions and 2 deletions

View File

@ -3831,6 +3831,7 @@ void QClipData::initialize()
Q_CHECK_PTR(m_clipLines);
QT_TRY {
allocated = clipSpanHeight;
count = 0;
QT_TRY {
if (hasRegionClip) {
const auto rects = clipRegion.begin();
@ -3842,7 +3843,6 @@ void QClipData::initialize()
int y = 0;
int firstInBand = 0;
count = 0;
while (firstInBand < numRects) {
const int currMinY = rects[firstInBand].y();
const int currMaxY = currMinY + rects[firstInBand].height();
@ -3900,7 +3900,6 @@ void QClipData::initialize()
}
const int len = clipRect.width();
count = 0;
while (y < ymax) {
QSpan *span = m_spans + count;
span->x = xmin;