Avoid potential read of uninitialized clip data

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

Change-Id: Ib3d1c4dc24373df3d4dbc393241226a8730bb9fc
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
(cherry picked from commit 9d2850bda946fab28f689d284fd670e5cf361d8f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
Allan Sandfeld Jensen 2021-05-11 15:52:23 +02:00 committed by Qt Cherry-pick Bot
parent 90fe6301ba
commit 242f8ef985

View File

@ -3830,6 +3830,7 @@ void QClipData::initialize()
Q_CHECK_PTR(m_clipLines);
QT_TRY {
allocated = clipSpanHeight;
count = 0;
QT_TRY {
if (hasRegionClip) {
const auto rects = clipRegion.begin();
@ -3841,7 +3842,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();
@ -3899,7 +3899,6 @@ void QClipData::initialize()
}
const int len = clipRect.width();
count = 0;
while (y < ymax) {
QSpan *span = m_spans + count;
span->x = xmin;