Skip to content
Permalink
Browse files

Fix crashes when reading certain resampled raster files

  • Loading branch information
github-actions authored and nyalldawson committed Jan 28, 2020
1 parent 8425ada commit 388277e642d99b93bd7f25197d6418b5dfb888bd
Showing with 2 additions and 0 deletions.
  1. +2 −0 src/core/providers/gdal/qgsgdalprovider.cpp
@@ -920,6 +920,7 @@ bool QgsGdalProvider::readBlock( int bandNo, QgsRectangle const &extent, int pi
for ( int row = 0; row < height; row++ )
{
int tmpRow = static_cast<int>( std::floor( -1. * ( tmpYMax - y ) / tmpYRes ) );
tmpRow = std::min( tmpRow, tmpHeight - 1 );

char *srcRowBlock = tmpBlock + dataSize * tmpRow * tmpWidth;
char *dstRowBlock = ( char * )data + dataSize * ( top + row ) * pixelWidth;
@@ -935,6 +936,7 @@ bool QgsGdalProvider::readBlock( int bandNo, QgsRectangle const &extent, int pi
{
// std::floor() is quite slow! Use just cast to int.
tmpCol = static_cast<int>( x );
tmpCol = std::min( tmpCol, tmpWidth - 1 );
if ( tmpCol > lastCol )
{
src += ( tmpCol - lastCol ) * dataSize;

0 comments on commit 388277e

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