summaryrefslogtreecommitdiff
path: root/filter
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2019-07-17 16:13:17 +0100
committerCaolán McNamara <caolanm@redhat.com>2019-07-18 09:39:09 +0200
commitc21847117a587f1eac99653d05e6ed9278d43f79 (patch)
treec4b772109fc1305b9c9767b55affc60bfaa207bd /filter
parentcefce1a247a4674c5726a31b61571eab16328a0b (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/75793 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'filter')
-rw-r--r--filter/source/graphicfilter/itiff/itiff.cxx11
1 files changed, 6 insertions, 5 deletions
diff --git a/filter/source/graphicfilter/itiff/itiff.cxx b/filter/source/graphicfilter/itiff/itiff.cxx
index 79a4d85aa66b..970e5958635f 100644
--- a/filter/source/graphicfilter/itiff/itiff.cxx
+++ b/filter/source/graphicfilter/itiff/itiff.cxx
@@ -570,9 +570,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;
@@ -1512,8 +1514,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;
}
}