[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-4.2' - 3 commits - filter/source sc/source vcl/source

Caolán McNamara caolanm at redhat.com
Mon Jan 5 07:03:05 PST 2015


 filter/source/graphicfilter/itiff/itiff.cxx |   11 +++++------
 sc/source/filter/excel/xistring.cxx         |    6 +++---
 vcl/source/filter/ixpm/xpmread.cxx          |    4 +++-
 3 files changed, 11 insertions(+), 10 deletions(-)

New commits:
commit 76b878d66dfb464accc4d1ce83b0d1f5c1094abc
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Fri Dec 19 09:52:39 2014 +0000

    valgrind: initialize these
    
    Change-Id: I6440832fe508689ffa8e20fa17827528331e3585
    (cherry picked from commit 2645b1979365085edf4a94500f2c610bfc4e668b)

diff --git a/sc/source/filter/excel/xistring.cxx b/sc/source/filter/excel/xistring.cxx
index 6bb003f..dc903c5 100644
--- a/sc/source/filter/excel/xistring.cxx
+++ b/sc/source/filter/excel/xistring.cxx
@@ -120,7 +120,7 @@ void XclImpString::ReadFormats( XclImpStream& rStrm, XclFormatRunVec& rFormats,
     {
         for( sal_uInt16 nIdx = 0; nIdx < nRunCount; ++nIdx )
         {
-            sal_uInt16 nChar, nFontIdx;
+            sal_uInt16 nChar(0), nFontIdx(0);
             rStrm >> nChar >> nFontIdx;
             AppendFormat( rFormats, nChar, nFontIdx );
         }
@@ -129,7 +129,7 @@ void XclImpString::ReadFormats( XclImpStream& rStrm, XclFormatRunVec& rFormats,
     {
         for( sal_uInt16 nIdx = 0; nIdx < nRunCount; ++nIdx )
         {
-            sal_uInt8 nChar, nFontIdx;
+            sal_uInt8 nChar(0), nFontIdx(0);
             rStrm >> nChar >> nFontIdx;
             AppendFormat( rFormats, nChar, nFontIdx );
         }
@@ -144,7 +144,7 @@ void XclImpString::ReadObjFormats( XclImpStream& rStrm, XclFormatRunVec& rFormat
     rFormats.reserve( nRunCount );
     for( sal_uInt16 nIdx = 0; nIdx < nRunCount; ++nIdx )
     {
-        sal_uInt16 nChar, nFontIdx;
+        sal_uInt16 nChar(0), nFontIdx(0);
         rStrm >> nChar >> nFontIdx;
         rStrm.Ignore( 4 );
         AppendFormat( rFormats, nChar, nFontIdx );
commit f997c9fb5078d529f61eecb19f6b8ad0fc15314e
Author: Markus Mohrhard <markus.mohrhard at collabora.co.uk>
Date:   Sun Dec 28 20:16:17 2014 +0100

    check size before looking into the string
    
    Found by Asan. e.g moz233272-2.xpm
    
    Change-Id: Ic563db41dbd4ce7250492e99f3e48a203cfdcf00
    Reviewed-on: https://gerrit.libreoffice.org/13686
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>
    (cherry picked from commit ba4b5741db25ff3b76a8d10d8f3745dfc1973749)
    (cherry picked from commit cda3b8767fd8f5b43b1043852e9f90fd17a129f4)

diff --git a/vcl/source/filter/ixpm/xpmread.cxx b/vcl/source/filter/ixpm/xpmread.cxx
index 3a85978..ff42c2a 100644
--- a/vcl/source/filter/ixpm/xpmread.cxx
+++ b/vcl/source/filter/ixpm/xpmread.cxx
@@ -23,6 +23,7 @@
 #include "rgbtable.hxx"
 #define _XPMPRIVATE
 #include "xpmread.hxx"
+#include <cstring>
 
 // -------------
 // - XPMReader -
@@ -348,7 +349,8 @@ bool XPMReader::ImplGetColSub( sal_uInt8* pDest )
             {
                 if ( pRGBTable[ i ].name == NULL )
                     break;
-                if ( pRGBTable[ i ].name[ mnParaSize ] == 0 )
+                if ( std::strlen(pRGBTable[i].name) > mnParaSize &&
+                        pRGBTable[ i ].name[ mnParaSize ] == 0 )
                 {
                     if ( ImplCompare ( (unsigned char*)pRGBTable[ i ].name,
                             mpPara, mnParaSize, XPMCASENONSENSITIVE ) )
commit d83cbc12afb9b6b91533d329015981d26adf8918
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/13739
    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 aa80b09..54efd86 100644
--- a/filter/source/graphicfilter/itiff/itiff.cxx
+++ b/filter/source/graphicfilter/itiff/itiff.cxx
@@ -934,23 +934,22 @@ sal_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 ) );
                             }
                         }
@@ -959,11 +958,11 @@ sal_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