From 242f8ef98527a9e25c8b028382eb4e16fe0ae8d7 Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Tue, 11 May 2021 15:52:23 +0200 Subject: [PATCH] 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 (cherry picked from commit 9d2850bda946fab28f689d284fd670e5cf361d8f) Reviewed-by: Qt Cherry-pick Bot --- src/gui/painting/qpaintengine_raster.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/gui/painting/qpaintengine_raster.cpp b/src/gui/painting/qpaintengine_raster.cpp index c527b167f68..90f4e048eda 100644 --- a/src/gui/painting/qpaintengine_raster.cpp +++ b/src/gui/painting/qpaintengine_raster.cpp @@ -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;