Skip to content

Commit

Permalink
[server] Use std::numeric_limits instead of INT_MAX
Browse files Browse the repository at this point in the history
  • Loading branch information
elpaso committed Jan 17, 2018
1 parent 74d76d5 commit bdb5727
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/server/services/wms/qgswmsrenderer.cpp
Expand Up @@ -1854,14 +1854,13 @@ namespace QgsWms

const int bytes_per_line = ( ( width * depth + 31 ) >> 5 ) << 2; // bytes per scanline (must be multiple of 4)

if ( INT_MAX / depth < width
if ( std::numeric_limits<int>::max() / depth < ( uint )width
|| bytes_per_line <= 0
|| height <= 0
|| INT_MAX / uint( bytes_per_line ) < height
|| INT_MAX / sizeof( uchar * ) < uint( height ) )
|| std::numeric_limits<int>::max() / uint( bytes_per_line ) < ( uint )height
|| std::numeric_limits<int>::max() / sizeof( uchar * ) < uint( height ) )
return false;


return true;
}

Expand Down

0 comments on commit bdb5727

Please sign in to comment.