Skip to content

Commit 2892557

Browse files
committed
Merge pull request opencv#14268 from alalek:fix_ossfuzz_13283
2 parents 1b5a9c9 + 0c490ac commit 2892557

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

modules/imgcodecs/src/grfmt_tiff.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -401,6 +401,10 @@ bool TiffDecoder::readData( Mat& img )
401401
(!is_tiled && tile_height0 == std::numeric_limits<uint32>::max()) )
402402
tile_height0 = m_height;
403403

404+
CV_Assert((int)tile_width0 > 0 && (int)tile_width0 < std::numeric_limits<int>::max());
405+
CV_Assert((int)tile_height0 > 0 && (int)tile_height0 < std::numeric_limits<int>::max());
406+
CV_Assert(((uint64_t)tile_width0 * tile_height0 * ncn * (bpp / bitsPerByte) < (CV_BIG_UINT(1) << 30)) && "TIFF tile size is too large: >= 1Gb");
407+
404408
if (dst_bpp == 8)
405409
{
406410
// we will use TIFFReadRGBA* functions, so allocate temporary buffer for 32bit RGBA

0 commit comments

Comments
 (0)