[Libreoffice-commits] core.git: 11 commits - bridges/source filter/source idlc/source jvmfwk/plugins reportdesign/source sc/source svl/source sw/source vcl/source

Caolán McNamara caolanm at redhat.com
Thu Oct 30 07:35:05 PDT 2014


 bridges/source/jni_uno/jni_info.cxx              |    1 
 filter/source/graphicfilter/ipict/ipict.cxx      |   25 +++++++++++++------
 idlc/source/parser.y                             |    1 
 jvmfwk/plugins/sunmajor/javaenvsetup/javaldx.cxx |   11 +++++++-
 reportdesign/source/ui/report/dlgedfunc.cxx      |   29 ++++++-----------------
 sc/source/core/opencl/op_statistical.cxx         |    9 -------
 svl/source/items/rngitem.cxx                     |   12 +++++----
 sw/source/filter/basflt/iodetect.cxx             |    4 +--
 vcl/source/gdi/pdfwriter_impl.cxx                |    7 ++++-
 9 files changed, 53 insertions(+), 46 deletions(-)

New commits:
commit 9d522e214c074b94cf8cbb6a82f80286838a3c54
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Thu Oct 30 14:21:13 2014 +0000

    coverity#982268 silence Copy-paste error
    
    Change-Id: I10e5dd8ea4097892d2571304d982ab20ee230988

diff --git a/idlc/source/parser.y b/idlc/source/parser.y
index c239fba..afa3801 100644
--- a/idlc/source/parser.y
+++ b/idlc/source/parser.y
@@ -2154,6 +2154,7 @@ at_least_one_scoped_name :
         } else
         {
             StringList* pScopedNames = new StringList();
+            //coverity [copy_paste_error]
             pScopedNames->push_back(*$1);
             $$ = pScopedNames;
         }
commit 37b53e179d7727c817d175d8102e87f7f23e9bb8
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Thu Oct 30 14:10:52 2014 +0000

    there are two of these GetUserData()[0] tests, use startsWith for both
    
    Change-Id: Iacb40220a87563a53a521b35efe208bb3b90e653

diff --git a/sw/source/filter/basflt/iodetect.cxx b/sw/source/filter/basflt/iodetect.cxx
index 64da606..5c5f6a5 100644
--- a/sw/source/filter/basflt/iodetect.cxx
+++ b/sw/source/filter/basflt/iodetect.cxx
@@ -171,7 +171,7 @@ const SfxFilter* SwIoSystem::GetFileFilter(const OUString& rFileName)
             {
                 while ( pFilter )
                 {
-                    if( !pFilter->GetUserData().isEmpty() && 'C' == pFilter->GetUserData()[0] && IsValidStgFilter( xStor, *pFilter ) )
+                    if (pFilter->GetUserData().startsWith("C") && IsValidStgFilter(xStor, *pFilter ))
                     {
                         if (pFilter->IsOwnTemplateFormat())
                         {
@@ -206,7 +206,7 @@ const SfxFilter* SwIoSystem::GetFileFilter(const OUString& rFileName)
             {
                 while ( pFilter )
                 {
-                    if( 'C' == pFilter->GetUserData()[0] && IsValidStgFilter( *xStg, *pFilter ) )
+                    if (pFilter->GetUserData().startsWith("C") && IsValidStgFilter(*xStg, *pFilter))
                     {
                         if (pFilter->IsOwnTemplateFormat())
                         {
commit 1c4fc13600e0466dc6d1816d3a0306db6566141a
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Thu Oct 30 13:19:04 2014 +0000

    coverity#704245 Logically dead code
    
    since
    
    commit 7599f68cee9141cd16ca7697872b5f83c6ae9ad9
    Author: Ivo Hinkelmann <ihi at openoffice.org>
    Date:   Wed Apr 22 11:01:27 2009 +0000
        CWS-TOOLING: integrate CWS dba32a
    
    Change-Id: I85c45344ca31d50bd99c12b8c9dc29478aadb067

diff --git a/reportdesign/source/ui/report/dlgedfunc.cxx b/reportdesign/source/ui/report/dlgedfunc.cxx
index 0706761..db21172 100644
--- a/reportdesign/source/ui/report/dlgedfunc.cxx
+++ b/reportdesign/source/ui/report/dlgedfunc.cxx
@@ -672,34 +672,21 @@ bool DlgEdFuncInsert::MouseButtonDown( const MouseEvent& rMEvt )
 
     const SdrHitKind eHit = m_rView.PickAnything(rMEvt, SDRMOUSEBUTTONDOWN, aVEvt);
 
-    if (eHit == SDRHIT_UNMARKEDOBJECT &&
-        nId != OBJ_CUSTOMSHAPE)
+    if (eHit == SDRHIT_UNMARKEDOBJECT && nId != OBJ_CUSTOMSHAPE)
     {
         // there is an object under the mouse cursor, but not a customshape
         m_pParent->getSectionWindow()->getViewsWindow()->BrkAction();
         return false;
     }
 
-    if( eHit != SDRHIT_UNMARKEDOBJECT || nId == OBJ_CUSTOMSHAPE)
+    // if no action, create object
+    if (!m_pParent->getSectionWindow()->getViewsWindow()->IsAction())
     {
-        // if no action, create object
-        if ( !m_pParent->getSectionWindow()->getViewsWindow()->IsAction() )
-        {
-            deactivateOle(true);
-            if ( m_pParent->getSectionWindow()->getViewsWindow()->HasSelection() )
-                m_pParent->getSectionWindow()->getViewsWindow()->unmarkAllObjects(&m_rView);
-            m_rView.BegCreateObj(m_aMDPos);
-            m_pParent->getSectionWindow()->getViewsWindow()->createDefault();
-        }
-    }
-    else
-    {
-        if( !rMEvt.IsShift() )
-        {
-            // shift key pressed?
-            m_pParent->getSectionWindow()->getViewsWindow()->unmarkAllObjects(NULL);
-        }
-        m_pParent->getSectionWindow()->getViewsWindow()->BegMarkObj( m_aMDPos,&m_rView );
+        deactivateOle(true);
+        if ( m_pParent->getSectionWindow()->getViewsWindow()->HasSelection() )
+            m_pParent->getSectionWindow()->getViewsWindow()->unmarkAllObjects(&m_rView);
+        m_rView.BegCreateObj(m_aMDPos);
+        m_pParent->getSectionWindow()->getViewsWindow()->createDefault();
     }
 
     return true;
commit 13f26219a44ef158f26c543ff926e57e5831b477
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Thu Oct 30 13:01:23 2014 +0000

    coverity#704095 Unchecked return value
    
    Change-Id: I31bfb0b6cdcac78592759824cb74ab62d98fcc7b

diff --git a/vcl/source/gdi/pdfwriter_impl.cxx b/vcl/source/gdi/pdfwriter_impl.cxx
index 172eac9..9242604 100644
--- a/vcl/source/gdi/pdfwriter_impl.cxx
+++ b/vcl/source/gdi/pdfwriter_impl.cxx
@@ -1781,7 +1781,12 @@ void PDFWriterImpl::PDFPage::appendWaveLine( sal_Int32 nWidth, sal_Int32 nY, sal
     m_aDigest = rtl_digest_createMD5();
 
     /* the size of the Codec default maximum */
-    checkEncryptionBufferSize( 0x4000 );
+    if (!checkEncryptionBufferSize(0x4000))
+    {
+        m_aFile.close();
+        m_bOpen = false;
+        return;
+    }
 
     if( xEnc.is() )
         prepareEncryption( xEnc );
commit dff10fc454183304dd820d1dfe1e7ac4010c5503
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Thu Oct 30 11:40:31 2014 +0000

    coverity#704134 silence Resource leak in object
    
    Change-Id: I7c2400e9f340562380423eb3300bbcf3eb4c4871

diff --git a/bridges/source/jni_uno/jni_info.cxx b/bridges/source/jni_uno/jni_info.cxx
index 3e34ecd..96f6957 100644
--- a/bridges/source/jni_uno/jni_info.cxx
+++ b/bridges/source/jni_uno/jni_info.cxx
@@ -848,6 +848,7 @@ JNI_info::JNI_info(
         css::uno::TypeDescription XInterface_td(
             ::getCppuType(
                 (css::uno::Reference< css::uno::XInterface > const *)0 ) );
+        //coverity [ctor_dtor_leak]
         m_XInterface_type_info =
             new JNI_interface_type_info( jni, XInterface_td.get() );
     }
commit 8902b340efd15af95df215c717e9807471f88446
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Thu Oct 30 11:36:41 2014 +0000

    coverity#1242442 Identical code for different branches
    
    Change-Id: Idf7d07398e42b1839c64b0607ec23c12d4c406ad

diff --git a/sc/source/core/opencl/op_statistical.cxx b/sc/source/core/opencl/op_statistical.cxx
index 839b46c..7fe8eed 100644
--- a/sc/source/core/opencl/op_statistical.cxx
+++ b/sc/source/core/opencl/op_statistical.cxx
@@ -5630,14 +5630,7 @@ void OpMedian::GenSlidingWindowFunction(
             {
                 ss << "gid0; endFlag = "<< nCurWindowSize <<"-gid0;\n";
             }
-            if (pCurDVR->IsStartFixed() && !pCurDVR->IsEndFixed())
-            {
-                ss << "gid0; endFlag = gid0+"<< nCurWindowSize <<";\n";
-            }
-            else
-            {
-                ss << "gid0; endFlag = gid0+"<< nCurWindowSize <<";\n";
-            }
+            ss << "gid0; endFlag = gid0+"<< nCurWindowSize <<";\n";
         }
         else
         {
commit b723d52a978f3c0f25639b17999acf7dae8c50b5
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Thu Oct 30 11:33:33 2014 +0000

    coverity#1242658 Untrusted loop bound
    
    Change-Id: I6b4605e3223d11fe4f905e0d9141043a0d7527da

diff --git a/filter/source/graphicfilter/ipict/ipict.cxx b/filter/source/graphicfilter/ipict/ipict.cxx
index a2f9eae..43cdf5c 100644
--- a/filter/source/graphicfilter/ipict/ipict.cxx
+++ b/filter/source/graphicfilter/ipict/ipict.cxx
@@ -988,6 +988,11 @@ sal_uLong PictReader::ReadPixMapEtc( Bitmap &rBitmap, bool bBaseAddr, bool bColo
 
         if ( nRowBytes < 8 || nPackType == 1 )
         {
+            const size_t nMaxPixels = pPict->remainingSize() / 4;
+            const size_t nMaxRows = nMaxPixels / nWidth;
+            if (nHeight > nMaxRows)
+                BITMAPERROR;
+
             for ( ny = 0; ny < nHeight; ny++ )
             {
                 for ( nx = 0; nx < nWidth; nx++ )
commit 9263fbe338604b817e65f5a8e623f96d67224158
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Thu Oct 30 11:32:33 2014 +0000

    inner condition is the same as outer one
    
    Change-Id: If573f4d21492506d631861d06842828f9abb61f4

diff --git a/filter/source/graphicfilter/ipict/ipict.cxx b/filter/source/graphicfilter/ipict/ipict.cxx
index a9dcff2..a2f9eae 100644
--- a/filter/source/graphicfilter/ipict/ipict.cxx
+++ b/filter/source/graphicfilter/ipict/ipict.cxx
@@ -990,15 +990,12 @@ sal_uLong PictReader::ReadPixMapEtc( Bitmap &rBitmap, bool bBaseAddr, bool bColo
         {
             for ( ny = 0; ny < nHeight; ny++ )
             {
-                if ( nRowBytes < 8 || nPackType == 1 )
+                for ( nx = 0; nx < nWidth; nx++ )
                 {
-                    for ( nx = 0; nx < nWidth; nx++ )
-                    {
-                        pPict->ReadUChar( nDummy ).ReadUChar( nRed ).ReadUChar( nGreen ).ReadUChar( nBlue );
-                        pAcc->SetPixel( ny, nx, BitmapColor( nRed, nGreen, nBlue) );
-                    }
-                    nDataSize += ( (sal_uLong)nWidth ) * 4;
+                    pPict->ReadUChar( nDummy ).ReadUChar( nRed ).ReadUChar( nGreen ).ReadUChar( nBlue );
+                    pAcc->SetPixel( ny, nx, BitmapColor( nRed, nGreen, nBlue) );
                 }
+                nDataSize += ( (sal_uLong)nWidth ) * 4;
             }
         }
         else if ( nPackType == 2 )
commit 123c4f4a6e418fa2babc1f0c383491833aeea947
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Thu Oct 30 11:27:56 2014 +0000

    coverity#1242658 Untrusted loop bound
    
    Change-Id: Ib37d08e5c55ca3c9f054684aa79dbe38d441f37a

diff --git a/filter/source/graphicfilter/ipict/ipict.cxx b/filter/source/graphicfilter/ipict/ipict.cxx
index 41ba717..a9dcff2 100644
--- a/filter/source/graphicfilter/ipict/ipict.cxx
+++ b/filter/source/graphicfilter/ipict/ipict.cxx
@@ -758,9 +758,11 @@ sal_uLong PictReader::ReadPixMapEtc( Bitmap &rBitmap, bool bBaseAddr, bool bColo
             pPict->SeekRel( 6 );
             pPict->ReadUInt16( nColTabSize );
 
-            if ( ++nColTabSize > 256 )
+            if (nColTabSize > 255)
                 BITMAPERROR;
 
+            ++nColTabSize;
+
             pAcc->SetPaletteEntryCount( nColTabSize );
 
             for ( i = 0; i < nColTabSize; i++ )
@@ -1001,6 +1003,11 @@ sal_uLong PictReader::ReadPixMapEtc( Bitmap &rBitmap, bool bBaseAddr, bool bColo
         }
         else if ( nPackType == 2 )
         {
+            const size_t nMaxPixels = pPict->remainingSize() / 3;
+            const size_t nMaxRows = nMaxPixels / nWidth;
+            if (nHeight > nMaxRows)
+                BITMAPERROR;
+
             for ( ny = 0; ny < nHeight; ny++ )
             {
                 for ( nx = 0; nx < nWidth; nx++ )
commit 947875577f5c8a926f5c188a0f977a2713f245b1
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Thu Oct 30 10:51:27 2014 +0000

    coverity#1242956 Untrusted loop bound
    
    Change-Id: I590207eee56bf40fbd9138719bbfd1fd05cbcd28

diff --git a/svl/source/items/rngitem.cxx b/svl/source/items/rngitem.cxx
index 3c09331..71e278f 100644
--- a/svl/source/items/rngitem.cxx
+++ b/svl/source/items/rngitem.cxx
@@ -106,25 +106,28 @@ SvStream& SfxRangeItem::Store(SvStream &rStream, sal_uInt16) const
     return rStream;
 }
 
-
 SfxUShortRangesItem::SfxUShortRangesItem()
 :   _pRanges(0)
 {
 }
 
-
 SfxUShortRangesItem::SfxUShortRangesItem( sal_uInt16 nWID, SvStream &rStream )
 :   SfxPoolItem( nWID )
 {
     sal_uInt16 nCount(0);
-    rStream.ReadUInt16( nCount );
+    rStream.ReadUInt16(nCount);
+    const size_t nMaxEntries = rStream.remainingSize() / sizeof(sal_uInt16);
+    if (nCount > nMaxEntries)
+    {
+        nCount = nMaxEntries;
+        SAL_WARN("svl.items", "SfxUShortRangesItem: truncated Stream");
+    }
     _pRanges = new sal_uInt16[nCount + 1];
     for ( sal_uInt16 n = 0; n < nCount; ++n )
         rStream.ReadUInt16( _pRanges[n] );
     _pRanges[nCount] = 0;
 }
 
-
 SfxUShortRangesItem::SfxUShortRangesItem( const SfxUShortRangesItem& rItem )
 :   SfxPoolItem( rItem )
 {
@@ -133,7 +136,6 @@ SfxUShortRangesItem::SfxUShortRangesItem( const SfxUShortRangesItem& rItem )
     memcpy( _pRanges, rItem._pRanges, sizeof(sal_uInt16) * nCount );
 }
 
-
 SfxUShortRangesItem::~SfxUShortRangesItem()
 {
     delete _pRanges;
commit c7b0c02ddd1aecb65ca3c82831a4cc779c9c8767
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Thu Oct 30 10:45:49 2014 +0000

    coverity#1247641 Uncaught exception
    
    Change-Id: I61e55095b4f74fd619a26cba88dd177d0e318154

diff --git a/jvmfwk/plugins/sunmajor/javaenvsetup/javaldx.cxx b/jvmfwk/plugins/sunmajor/javaenvsetup/javaldx.cxx
index 8f5e5a2..bec224e 100644
--- a/jvmfwk/plugins/sunmajor/javaenvsetup/javaldx.cxx
+++ b/jvmfwk/plugins/sunmajor/javaenvsetup/javaldx.cxx
@@ -65,7 +65,16 @@ SAL_IMPLEMENT_MAIN_WITH_ARGS(argc, argv)
 
 
     JavaInfo * pInfo = NULL;
-    errcode = jfw_getSelectedJRE( & pInfo);
+
+    try
+    {
+        errcode = jfw_getSelectedJRE( & pInfo);
+    }
+    catch (const std::exception&)
+    {
+        fprintf(stderr,"javaldx failed!\n");
+        return -1;
+    }
 
     if (errcode != JFW_E_NONE && errcode != JFW_E_INVALID_SETTINGS)
     {


More information about the Libreoffice-commits mailing list