From 7c97fdb32acbfdca189a81f6c93e5eb76f4c0659 Mon Sep 17 00:00:00 2001 From: Nyall Dawson Date: Fri, 3 Mar 2023 10:59:11 +1000 Subject: [PATCH] Fix some overflows when exporting large files with blur effects --- src/core/effects/qgsimageoperation.cpp | 2 +- src/core/effects/qgsimageoperation.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/core/effects/qgsimageoperation.cpp b/src/core/effects/qgsimageoperation.cpp index c5b8b6ce0ae..97789794202 100644 --- a/src/core/effects/qgsimageoperation.cpp +++ b/src/core/effects/qgsimageoperation.cpp @@ -771,7 +771,7 @@ inline QRgb QgsImageOperation::GaussianBlurOperation::gaussianBlurVertical( cons for ( int i = 0; i <= mRadius * 2; ++i ) { y = std::clamp( posy + ( i - mRadius ), 0, height - 1 ); - ref = sourceFirstLine + sourceBpl * y; + ref = sourceFirstLine + static_cast< std::size_t >( sourceBpl ) * y; QRgb *refRgb = reinterpret_cast< QRgb * >( ref ); r += mKernel[i] * qRed( *refRgb ); diff --git a/src/core/effects/qgsimageoperation.h b/src/core/effects/qgsimageoperation.h index 49de42737d0..a4d6a6ded56 100644 --- a/src/core/effects/qgsimageoperation.h +++ b/src/core/effects/qgsimageoperation.h @@ -445,7 +445,7 @@ class CORE_EXPORT QgsImageOperation int increment = ( mDirection == QgsImageOperation::ByRow ) ? 4 : bytesPerLine; if ( !mForwardDirection ) { - p += ( lineLength - 1 ) * increment; + p += static_cast< std::size_t >( lineLength - 1 ) * increment; increment = -increment; }