Fix some overflows when exporting large files with blur effects

This commit is contained in:
Nyall Dawson 2023-03-03 10:59:11 +10:00
parent d1d4b8442f
commit 7c97fdb32a
2 changed files with 2 additions and 2 deletions

View File

@ -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 );

View File

@ -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;
}