Skip to content
Permalink
Browse files

[raster] Fix unintentional int overflow

  • Loading branch information
nyalldawson committed Feb 15, 2015
1 parent 4a4a700 commit ccdf452ef4a076b54aedd00aeb98c6ad92966d58
Showing with 4 additions and 4 deletions.
  1. +2 −2 src/core/raster/qgsrasterblock.cpp
  2. +2 −2 src/core/raster/qgsrasterdataprovider.cpp
@@ -679,7 +679,7 @@ bool QgsRasterBlock::convert( QGis::DataType destDataType )

if ( typeIsNumeric( mDataType ) && typeIsNumeric( destDataType ) )
{
void *data = convert( mData, mDataType, destDataType, mWidth * mHeight );
void *data = convert( mData, mDataType, destDataType, ( qgssize )mWidth * ( qgssize )mHeight );

if ( data == 0 )
{
@@ -728,7 +728,7 @@ void QgsRasterBlock::applyNoDataValues( const QgsRasterRangeList & rangeList )
return;
}

qgssize size = mWidth * mHeight;
qgssize size = ( qgssize )mWidth * ( qgssize )mHeight;
for ( qgssize i = 0; i < size; ++i )
{
double val = value( i );
@@ -182,8 +182,8 @@ QgsRasterBlock * QgsRasterDataProvider::block( int theBandNo, QgsRectangle cons
return block;
}

qgssize tmpIndex = tmpRow * tmpWidth + tmpCol;
qgssize index = row * theWidth + col;
qgssize tmpIndex = ( qgssize )tmpRow * ( qgssize )tmpWidth + tmpCol;
qgssize index = row * ( qgssize )theWidth + col;

char *tmpBits = tmpBlock->bits( tmpIndex );
char *bits = block->bits( index );

0 comments on commit ccdf452

Please sign in to comment.
You can’t perform that action at this time.