diff options
author | Caolán McNamara <caolanm@redhat.com> | 2019-07-17 16:13:17 +0100 |
---|---|---|
committer | Andras Timar <andras.timar@collabora.com> | 2019-08-05 09:54:47 +0200 |
commit | 986437766b35e800fb9b0cacac6e2555b8f02bc0 (patch) | |
tree | 062fed110a25dd5ac3f6db414d7d99e1f2e914ab /filter | |
parent | a40e8da905ca2de1b8155456da9d9be83a140bd9 (diff) |
Resolves: tdf#126147 relax sanity check and allow truncated tiffs
now the start of the row of data must still exist, but the full
length of the row doesn't have to exist
Change-Id: I5ed8ffef2cab19f040ba789a5d82560ca6847f26
Reviewed-on: https://gerrit.libreoffice.org/75795
Tested-by: Jenkins
Reviewed-by: Michael Stahl <Michael.Stahl@cib.de>
(cherry picked from commit 38bf835b48efa2e32d917538cabc4fa2e1dec56d)
Reviewed-on: https://gerrit.libreoffice.org/76933
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Andras Timar <andras.timar@collabora.com>
Diffstat (limited to 'filter')
-rw-r--r-- | filter/source/graphicfilter/itiff/itiff.cxx | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/filter/source/graphicfilter/itiff/itiff.cxx b/filter/source/graphicfilter/itiff/itiff.cxx index d2bb00e3720f..9c2236689fac 100644 --- a/filter/source/graphicfilter/itiff/itiff.cxx +++ b/filter/source/graphicfilter/itiff/itiff.cxx @@ -568,9 +568,11 @@ bool TIFFReader::ReadMap() if ( nStrip >= aStripOffsets.size()) return false; pTIFF->Seek( aStripOffsets[ nStrip ] + ( ny % GetRowsPerStrip() ) * nStripBytesPerRow ); - pTIFF->ReadBytes(getMapData(np), nBytesPerRow); - if (!pTIFF->good()) - return false; + // tdf#126147 allow a short incomplete read + auto pDest = getMapData(np); + auto nRead = pTIFF->ReadBytes(pDest, nBytesPerRow); + if (nRead != nBytesPerRow) + memset(pDest + nRead, 0, nBytesPerRow - nRead); } if ( !ConvertScanline( ny ) ) return false; @@ -1510,8 +1512,7 @@ bool TIFFReader::ReadTIFF(SvStream & rTIFF, Graphic & rGraphic ) if (bStatus) { auto nStart = aStripOffsets[ nStrip ] + ( ny % GetRowsPerStrip() ) * nStripBytesPerRow; - auto nEnd = nStart + nBytesPerRow; - if (nEnd > nEndOfFile) + if (nStart > nEndOfFile) bStatus = false; } } |