[Libreoffice-commits] core.git: Branch 'libreoffice-4-4' - filter/qa filter/source
Caolán McNamara
caolanm at redhat.com
Mon Jul 20 12:52:41 PDT 2015
filter/qa/cppunit/data/tiff/fail/hang-8.tiff |binary
filter/source/graphicfilter/itiff/itiff.cxx | 6 ++++--
2 files changed, 4 insertions(+), 2 deletions(-)
New commits:
commit 8539045d4bb9666838d3ad15c3105600be0fc1f5
Author: Caolán McNamara <caolanm at redhat.com>
Date: Mon Jul 20 11:40:34 2015 +0100
fail on short read
Change-Id: I7215cf8d8b1e4a4156c87507018de3c2b7ed08d8
(cherry picked from commit 8eaef6b5217eecaa111c80e426bdf225481a71fb)
Reviewed-on: https://gerrit.libreoffice.org/17221
Reviewed-by: David Tardon <dtardon at redhat.com>
Tested-by: David Tardon <dtardon at redhat.com>
diff --git a/filter/qa/cppunit/data/tiff/fail/hang-8.tiff b/filter/qa/cppunit/data/tiff/fail/hang-8.tiff
new file mode 100644
index 0000000..c458597
Binary files /dev/null and b/filter/qa/cppunit/data/tiff/fail/hang-8.tiff differ
diff --git a/filter/source/graphicfilter/itiff/itiff.cxx b/filter/source/graphicfilter/itiff/itiff.cxx
index 0c3fbd6..f8bc193 100644
--- a/filter/source/graphicfilter/itiff/itiff.cxx
+++ b/filter/source/graphicfilter/itiff/itiff.cxx
@@ -669,7 +669,7 @@ bool TIFFReader::ReadMap( sal_uLong nMinPercent, sal_uLong nMaxPercent )
}
else if ( nCompression == 32773 )
{
- sal_uLong nStrip,nRecCount,nRowBytesLeft,np,i;
+ sal_uLong nStrip,nRecCount,np,i;
sal_uInt8 * pdst;
nStrip = 0;
if ( nStrip >= nNumStripOffsets )
@@ -686,7 +686,7 @@ bool TIFFReader::ReadMap( sal_uLong nMinPercent, sal_uLong nMaxPercent )
return false;
pTIFF->Seek(pStripOffsets[nStrip]);
}
- nRowBytesLeft = nBytesPerRow;
+ sal_uLong nRowBytesLeft = nBytesPerRow;
if (np >= SAL_N_ELEMENTS(pMap))
return false;
pdst=pMap[ np ];
@@ -700,6 +700,8 @@ bool TIFFReader::ReadMap( sal_uLong nMinPercent, sal_uLong nMaxPercent )
if ( nRecCount > nRowBytesLeft )
return false;
pTIFF->Read(pdst,nRecCount);
+ if (!pTIFF->good())
+ return false;
pdst+=nRecCount;
nRowBytesLeft-=nRecCount;
}
More information about the Libreoffice-commits
mailing list