[Libreoffice-commits] core.git: Branch 'libreoffice-6-3' - filter/source

Caolán McNamara (via logerrit) logerrit at kemper.freedesktop.org
Thu Jul 18 08:44:31 UTC 2019


 filter/source/graphicfilter/itiff/itiff.cxx |   11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

New commits:
commit d743130a98a168ba17dcb082cd3fb6efc335a86a
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Wed Jul 17 16:13:17 2019 +0100
Commit:     Michael Stahl <Michael.Stahl at cib.de>
CommitDate: Thu Jul 18 10:43:40 2019 +0200

    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/75794
    Tested-by: Jenkins
    Reviewed-by: Michael Stahl <Michael.Stahl at cib.de>

diff --git a/filter/source/graphicfilter/itiff/itiff.cxx b/filter/source/graphicfilter/itiff/itiff.cxx
index 956efdbb4f6c..7509777b6122 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;
                     }
                 }


More information about the Libreoffice-commits mailing list