diff options
author | Qt Forward Merge Bot <qt_forward_merge_bot@qt-project.org> | 2018-10-20 03:00:03 +0200 |
---|---|---|
committer | Qt Forward Merge Bot <qt_forward_merge_bot@qt-project.org> | 2018-10-20 03:00:04 +0200 |
commit | bad0c9bbcc6fbbc23fe88c0edd54f3e1e0644434 (patch) | |
tree | 908094af9e2bec2f2f85e96490d8d76fa527b022 /src/3rdparty/libtiff/libtiff/tif_dirread.c | |
parent | 454c0df87b3699c4291c324f786698864ba171fa (diff) | |
parent | 4783c6dc4441ab833050a08996d40d959960ecff (diff) |
Merge remote-tracking branch 'origin/5.12' into dev
Change-Id: I946f97342788aedfd076c98abd44841720e507ed
Diffstat (limited to 'src/3rdparty/libtiff/libtiff/tif_dirread.c')
-rw-r--r-- | src/3rdparty/libtiff/libtiff/tif_dirread.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/3rdparty/libtiff/libtiff/tif_dirread.c b/src/3rdparty/libtiff/libtiff/tif_dirread.c index 5e62e81..aa258ba 100644 --- a/src/3rdparty/libtiff/libtiff/tif_dirread.c +++ b/src/3rdparty/libtiff/libtiff/tif_dirread.c @@ -5698,6 +5698,16 @@ ChopUpSingleUncompressedStrip(TIFF* tif) if( nstrips == 0 ) return; + /* If we are going to allocate a lot of memory, make sure that the */ + /* file is as big as needed */ + if( tif->tif_mode == O_RDONLY && + nstrips > 1000000 && + (offset >= TIFFGetFileSize(tif) || + stripbytes > (TIFFGetFileSize(tif) - offset) / (nstrips - 1)) ) + { + return; + } + newcounts = (uint64*) _TIFFCheckMalloc(tif, nstrips, sizeof (uint64), "for chopped \"StripByteCounts\" array"); newoffsets = (uint64*) _TIFFCheckMalloc(tif, nstrips, sizeof (uint64), |