Don't allocate lots of memory when reading TIFFs with infinite rows per strip.
Some TIFF images consist of only one strip. The magic value 2**32-1 for the "rows per strip" tag reflects that fact, effectively meaning "infinite". Conflicts: modules/highgui/src/grfmt_tiff.cpp modules/highgui/test/test_grfmt.cpp fix whitespace fix compile error
This commit is contained in:
@@ -48,6 +48,7 @@
|
||||
#include "precomp.hpp"
|
||||
#include "grfmt_tiff.hpp"
|
||||
#include <opencv2/imgproc.hpp>
|
||||
#include <limits>
|
||||
|
||||
namespace cv
|
||||
{
|
||||
@@ -242,7 +243,8 @@ bool TiffDecoder::readData( Mat& img )
|
||||
if( tile_width0 <= 0 )
|
||||
tile_width0 = m_width;
|
||||
|
||||
if( tile_height0 <= 0 )
|
||||
if( tile_height0 <= 0 ||
|
||||
(!is_tiled && tile_height0 == std::numeric_limits<uint32>::max()) )
|
||||
tile_height0 = m_height;
|
||||
|
||||
AutoBuffer<uchar> _buffer( size_t(8) * tile_height0*tile_width0);
|
||||
|
Reference in New Issue
Block a user