From cfdcf9f2d22ad5d28720716af5587d39a7843cca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20St=C3=BChrk?= Date: Sun, 19 Oct 2014 01:22:04 +0200 Subject: [PATCH] TIFF loader: Allocate large enough buffer when (bpp * ncn) > 8. --- modules/highgui/src/grfmt_tiff.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/modules/highgui/src/grfmt_tiff.cpp b/modules/highgui/src/grfmt_tiff.cpp index ac36a55aec..b84c9e93ed 100644 --- a/modules/highgui/src/grfmt_tiff.cpp +++ b/modules/highgui/src/grfmt_tiff.cpp @@ -214,7 +214,8 @@ bool TiffDecoder::readData( Mat& img ) (!is_tiled && tile_height0 == std::numeric_limits::max()) ) tile_height0 = m_height; - AutoBuffer _buffer( size_t(8) * tile_height0*tile_width0); + const size_t buffer_size = bpp * ncn * tile_height0 * tile_width0; + AutoBuffer _buffer( buffer_size ); uchar* buffer = _buffer; ushort* buffer16 = (ushort*)buffer; float* buffer32 = (float*)buffer;