Skip to content
Permalink
Browse files

[server] Use std::numeric_limits instead of INT_MAX

  • Loading branch information
elpaso committed Jan 17, 2018
1 parent 74d76d5 commit bdb572781b7ef8b0958eb6f2d9b7c974312d230c
Showing with 3 additions and 4 deletions.
  1. +3 −4 src/server/services/wms/qgswmsrenderer.cpp
@@ -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;
}

0 comments on commit bdb5727

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