diff options
author | Marc Mutz <marc.mutz@qt.io> | 2022-05-31 21:10:06 +0200 |
---|---|---|
committer | Marc Mutz <marc.mutz@qt.io> | 2022-06-01 02:36:28 +0200 |
commit | 70575264bd1d3caef6c3c6e7b19cffa6d94f804b (patch) | |
tree | 1756b88ba38a217980e53ca31ebf01f1ba9efc5f /src/gui/painting | |
parent | 663b375373d18c2a10e88223c4a16ea64aec3524 (diff) |
QRasterPaintEngine: fix GCC 12 -Werror=array-bounds
An enum variable can legally have values larger than the largest
enumerator, so GCC isn't wrong in warning about accesses out of
bounds. But we know that we don't OR enumerators of this enum
together, so tell GCC, too, by using a Q_ASSUME().
Pick-to: 6.3 6.2
Task-number: QTBUG-103923
Change-Id: I3472fdb19a73a22f04df53a13f809d899613adf5
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src/gui/painting')
-rw-r--r-- | src/gui/painting/qpaintengine_raster.cpp | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/src/gui/painting/qpaintengine_raster.cpp b/src/gui/painting/qpaintengine_raster.cpp index 4192a0fa07..52ee689188 100644 --- a/src/gui/painting/qpaintengine_raster.cpp +++ b/src/gui/painting/qpaintengine_raster.cpp @@ -2277,6 +2277,7 @@ void QRasterPaintEngine::drawImage(const QRectF &r, const QImage &img, const QRe || d->rasterBuffer->compositionMode == QPainter::CompositionMode_Source)) { RotationType rotationType = qRotationType(s->matrix); + Q_ASSUME(d->rasterBuffer->format < QImage::NImageFormats); const QPixelLayout::BPP plBpp = qPixelLayouts[d->rasterBuffer->format].bpp; if (rotationType != NoRotation && qMemRotateFunctions[plBpp][rotationType] && img.rect().contains(sr.toAlignedRect())) { |