Skip to content

Commit

Permalink
[raster] Fix unintentional int overflow
Browse files Browse the repository at this point in the history
  • Loading branch information
nyalldawson committed Feb 15, 2015
1 parent 4a4a700 commit ccdf452
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/core/raster/qgsrasterblock.cpp
Expand Up @@ -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 )
{
Expand Down Expand Up @@ -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 );
Expand Down
4 changes: 2 additions & 2 deletions src/core/raster/qgsrasterdataprovider.cpp
Expand Up @@ -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 );
Expand Down

0 comments on commit ccdf452

Please sign in to comment.