[Libreoffice-commits] core.git: Branch 'libreoffice-5-3' - filter/source
Caolán McNamara
caolanm at redhat.com
Tue Feb 28 10:58:31 UTC 2017
filter/source/graphicfilter/itiff/itiff.cxx | 16 +++++++++++-----
1 file changed, 11 insertions(+), 5 deletions(-)
New commits:
commit 4d31e570f69fd8ec5294ea2aea019b57637bccb9
Author: Caolán McNamara <caolanm at redhat.com>
Date: Thu Feb 23 11:01:00 2017 +0000
ofz: don't read data that isn't there
Change-Id: I7fdcb78bde8f650c1a57d34177d8993a6d8a0a2f
(cherry picked from commit ee619fb344c7e8f491e09bd256df7f8567af9bef)
improve scoping
Change-Id: Ic79d46da4e322a0f52981c3a3df65f7f0294fdd8
(cherry picked from commit 840ad0a88045021c58644404a099a3678a371020)
make this a little clearer
no logic change intended
Change-Id: Ibfc46d0aba9e220be54270734e0cdfbc123be9a5
(cherry picked from commit 46b1b5dd2a5368663fd56434160fa126f1a54d84)
Reviewed-on: https://gerrit.libreoffice.org/34572
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Miklos Vajna <vmiklos at collabora.co.uk>
diff --git a/filter/source/graphicfilter/itiff/itiff.cxx b/filter/source/graphicfilter/itiff/itiff.cxx
index 96c7f0c..48f985e 100644
--- a/filter/source/graphicfilter/itiff/itiff.cxx
+++ b/filter/source/graphicfilter/itiff/itiff.cxx
@@ -786,7 +786,7 @@ sal_uLong TIFFReader::GetBits( const sal_uInt8 * pSrc, sal_uLong nBitsPos, sal_u
bool TIFFReader::ConvertScanline(sal_Int32 nY)
{
- sal_uInt32 nRed, nGreen, nBlue, ns, nVal, nByteCount;
+ sal_uInt32 nRed, nGreen, nBlue, ns, nVal;
sal_uInt8 nByteVal;
if ( nDstBitsPerPixel == 24 )
@@ -997,11 +997,18 @@ bool TIFFReader::ConvertScanline(sal_Int32 nY)
case 1 :
{
+ sal_uInt32 nByteCount = nImageWidth >> 3;
+
+ sal_uInt32 nBytesNeeded = nByteCount;
+ if (nImageWidth & 7)
+ ++nBytesNeeded;
+ if (pt + nBytesNeeded > ptend)
+ return false;
+
if ( bByteSwap )
{
sal_Int32 nx = 0;
- nByteCount = ( nImageWidth >> 3 ) + 1;
- while ( --nByteCount )
+ while (nByteCount--)
{
nByteVal = *pt++;
pAcc->SetPixelIndex( nY, nx++, nByteVal & 1 );
@@ -1033,8 +1040,7 @@ bool TIFFReader::ConvertScanline(sal_Int32 nY)
else
{
sal_Int32 nx = 7;
- nByteCount = ( nImageWidth >> 3 ) + 1;
- while ( --nByteCount )
+ while (nByteCount--)
{
nByteVal = *pt++;
pAcc->SetPixelIndex( nY, nx, nByteVal & 1 );
More information about the Libreoffice-commits
mailing list