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

Caolán McNamara caolanm at redhat.com
Mon Jan 5 06:53:27 PST 2015


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

New commits:
commit 75bec3ec6a5aa4f792e8bc81bc441254d9aff18c
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Mon Jan 5 10:56:32 2015 +0000

    asan wrt mandriva57054-1.tiff
    
    Change-Id: Ibb7ecfa637ff96fbda3a8ed5d67943ece28927e5
    (cherry picked from commit f901624b5e13e300f8e2facd2a824202c21d9729)
    Reviewed-on: https://gerrit.libreoffice.org/13738
    Reviewed-by: Markus Mohrhard <markus.mohrhard at googlemail.com>
    Tested-by: Markus Mohrhard <markus.mohrhard at googlemail.com>

diff --git a/filter/source/graphicfilter/itiff/itiff.cxx b/filter/source/graphicfilter/itiff/itiff.cxx
index 719f51d..9dfa328 100644
--- a/filter/source/graphicfilter/itiff/itiff.cxx
+++ b/filter/source/graphicfilter/itiff/itiff.cxx
@@ -928,23 +928,22 @@ bool TIFFReader::ConvertScanline( sal_uLong nY )
             {
                 case 8 :
                 {
-                    sal_uInt8 nLast;
                     if ( bByteSwap )
                     {
                         if ( nPredictor == 2 )
                         {
-                            nLast = BYTESWAP( (sal_uInt8)*pt++ );
+                            sal_uInt8 nLast = 0;
                             for ( nx = 0; nx < nImageWidth; nx++ )
                             {
+                                nLast += nx == 0 ? BYTESWAP( (sal_uInt8)*pt++ ) : *pt++;
                                 pAcc->SetPixelIndex( nY, nx, nLast );
-                                nLast = nLast + *pt++;
                             }
                         }
                         else
                         {
                             for ( nx = 0; nx < nImageWidth; nx++ )
                             {
-                                nLast = *pt++;
+                                sal_uInt8 nLast = *pt++;
                                 pAcc->SetPixelIndex( nY, nx, static_cast<sal_uInt8>( (BYTESWAP((sal_uLong)nLast) - nMinSampleValue) * nMinMax ) );
                             }
                         }
@@ -953,11 +952,11 @@ bool TIFFReader::ConvertScanline( sal_uLong nY )
                     {
                         if ( nPredictor == 2 )
                         {
-                            nLast = *pt++;
+                            sal_uInt8 nLast = 0;
                             for ( nx = 0; nx < nImageWidth; nx++ )
                             {
+                                nLast += *pt++;
                                 pAcc->SetPixelIndex( nY, nx, nLast );
-                                nLast = nLast + *pt++;
                             }
                         }
                         else


More information about the Libreoffice-commits mailing list