[Libreoffice-commits] core.git: 17 commits - connectivity/source forms/source include/vcl package/source store/source svx/source sw/source vcl/source

David Tardon dtardon at redhat.com
Tue Nov 4 10:53:33 PST 2014


 connectivity/source/drivers/odbc/ODatabaseMetaData.cxx          |   12 ++++-
 connectivity/source/drivers/odbc/ODatabaseMetaDataResultSet.cxx |    2 
 connectivity/source/drivers/odbc/OResultSet.cxx                 |    2 
 connectivity/source/drivers/odbc/OStatement.cxx                 |    2 
 forms/source/component/ListBox.cxx                              |    2 
 include/vcl/salbtype.hxx                                        |    1 
 package/source/xstor/xstorage.cxx                               |   21 ++++++----
 store/source/storpage.cxx                                       |    4 -
 svx/source/engine3d/dragmt3d.cxx                                |    3 +
 svx/source/engine3d/obj3d.cxx                                   |    4 +
 svx/source/engine3d/viewpt3d2.cxx                               |    5 ++
 sw/source/uibase/config/uinums.cxx                              |    3 -
 vcl/source/gdi/pdfwriter_impl.cxx                               |    6 ++
 13 files changed, 51 insertions(+), 16 deletions(-)

New commits:
commit c7ba28eaa766f2c1d4f0d3b25b40dd40777bc66b
Author: David Tardon <dtardon at redhat.com>
Date:   Tue Nov 4 19:35:44 2014 +0100

    coverity#1242845 use of untrusted scalar
    
    Change-Id: I25712384f1633506c047667606b4bc254e2ff04b

diff --git a/sw/source/uibase/config/uinums.cxx b/sw/source/uibase/config/uinums.cxx
index 40de91d..107ce2a 100644
--- a/sw/source/uibase/config/uinums.cxx
+++ b/sw/source/uibase/config/uinums.cxx
@@ -398,7 +398,8 @@ SwNumRulesWithName::_SwNumFmtGlobal::_SwNumFmtGlobal( SvStream& rStream,
         {
             sal_uInt16 nWhich, nVers;
             rStream.ReadUInt16( nWhich ).ReadUInt16( nVers );
-            aItems.push_back( GetDfltAttr( nWhich )->Create( rStream, nVers ) );
+            if ( ( nWhich >= POOLATTR_BEGIN ) && ( nWhich < POOLATTR_END ) )
+                aItems.push_back( GetDfltAttr( nWhich )->Create( rStream, nVers ) );
         }
     }
 
commit 025da16223a28263059d9d02be276459dcc9ca75
Author: David Tardon <dtardon at redhat.com>
Date:   Tue Nov 4 19:26:45 2014 +0100

    coverity#1242933 unused value
    
    Change-Id: I416144a4ccf2856ce85ab4b24a69958615276cb9

diff --git a/store/source/storpage.cxx b/store/source/storpage.cxx
index baf8f74..b97a945 100644
--- a/store/source/storpage.cxx
+++ b/store/source/storpage.cxx
@@ -968,7 +968,7 @@ storeError OStorePageManager::rebuild (
                     {
                         // Ordinary attributes.
                         sal_uInt32 nAttrib = 0;
-                        eErrCode = attrib (e.m_aKey, 0, e.m_nAttrib, nAttrib);
+                        attrib (e.m_aKey, 0, e.m_nAttrib, nAttrib);
                     }
                 }
             }
commit 2ba3fd5a1aa1623703defa3772b1e8a2a122ebcc
Author: David Tardon <dtardon at redhat.com>
Date:   Tue Nov 4 19:23:17 2014 +0100

    coverity#1242809 unused value
    
    Change-Id: I16430567b3d57016458bd7877c36bc6e01197741

diff --git a/store/source/storpage.cxx b/store/source/storpage.cxx
index 28fd219..baf8f74 100644
--- a/store/source/storpage.cxx
+++ b/store/source/storpage.cxx
@@ -959,7 +959,7 @@ storeError OStorePageManager::rebuild (
                         if (eErrCode == store_E_None)
                         {
                             OStorePageKey aDstKey (aSrcPage.key());
-                            eErrCode = link (e.m_aKey, aDstKey);
+                            link (e.m_aKey, aDstKey);
                         }
                         e.m_nAttrib &= ~STORE_ATTRIB_ISLINK;
                     }
commit 15492438f5dcb6e239c53d5c02d8ca442bd438a0
Author: David Tardon <dtardon at redhat.com>
Date:   Tue Nov 4 18:54:38 2014 +0100

    coverity#706578 uncaught exception
    
    Change-Id: I70640f42db49da274118f7336ff072b1b53ac640

diff --git a/package/source/xstor/xstorage.cxx b/package/source/xstor/xstorage.cxx
index 0b1193f..773fd79 100644
--- a/package/source/xstor/xstorage.cxx
+++ b/package/source/xstor/xstorage.cxx
@@ -5986,15 +5986,22 @@ uno::Reference< embed::XExtendedStorageStream > SAL_CALL OStorage::openStreamEle
     uno::Reference< embed::XExtendedStorageStream > xResult;
     if ( aListPath.size() == 1 )
     {
-        // that must be a direct request for a stream
-        // the transacted version of the stream should be opened
+        try
+        {
+            // that must be a direct request for a stream
+            // the transacted version of the stream should be opened
 
-        SotElement_Impl *pElement = OpenStreamElement_Impl( aStreamPath, nOpenMode, false );
-        assert(pElement && pElement->m_pStream && "In case element can not be created an exception must be thrown!");
+            SotElement_Impl *pElement = OpenStreamElement_Impl( aStreamPath, nOpenMode, false );
+            assert(pElement && pElement->m_pStream && "In case element can not be created an exception must be thrown!");
 
-        xResult = uno::Reference< embed::XExtendedStorageStream >(
-                        pElement->m_pStream->GetStream( nOpenMode, true ),
-                        uno::UNO_QUERY_THROW );
+            xResult = uno::Reference< embed::XExtendedStorageStream >(
+                            pElement->m_pStream->GetStream( nOpenMode, true ),
+                            uno::UNO_QUERY_THROW );
+        }
+        catch ( const container::NoSuchElementException & )
+        {
+            throw io::IOException( THROW_WHERE ); // file not found
+        }
     }
     else
     {
commit cd6e6712a18f45c92d6f915275b32964af887586
Author: David Tardon <dtardon at redhat.com>
Date:   Tue Nov 4 17:03:05 2014 +0100

    coverity#706543 uncaught exception
    
    Change-Id: I65932932712dad87f8e21dcd09f477744cc33763

diff --git a/forms/source/component/ListBox.cxx b/forms/source/component/ListBox.cxx
index 5931ac7..2d42a97 100644
--- a/forms/source/component/ListBox.cxx
+++ b/forms/source/component/ListBox.cxx
@@ -412,7 +412,7 @@ namespace frm
 
         case PROPERTY_ID_VALUE_SEQ :
             SAL_WARN( "forms.component", "ValueItemList is read-only!" );
-            throw PropertyVetoException();
+            throw IllegalArgumentException();
 
         case PROPERTY_ID_SELECT_VALUE_SEQ :
             bModified = tryPropertyValue(_rConvertedValue, _rOldValue, _rValue, getCurrentMultiValue());
commit 8bb9a0611438cd668a35d6424c41a476c7d9ceba
Author: David Tardon <dtardon at redhat.com>
Date:   Tue Nov 4 16:53:38 2014 +0100

    coverity#706375 uncaught exception
    
    Change-Id: I3d198d60524224e22d7f609ddde1ed8c3c319da9

diff --git a/connectivity/source/drivers/odbc/OStatement.cxx b/connectivity/source/drivers/odbc/OStatement.cxx
index 9c39db6..de88682 100644
--- a/connectivity/source/drivers/odbc/OStatement.cxx
+++ b/connectivity/source/drivers/odbc/OStatement.cxx
@@ -176,7 +176,7 @@ void SAL_CALL OStatement_Base::cancel(  ) throw(RuntimeException, std::exception
     checkDisposed(OStatement_BASE::rBHelper.bDisposed);
 
     OSL_ENSURE(m_aStatementHandle,"StatementHandle is null!");
-    OTools::ThrowException(m_pConnection,N3SQLCancel(m_aStatementHandle),m_aStatementHandle,SQL_HANDLE_STMT,*this);
+    N3SQLCancel(m_aStatementHandle);
 }
 
 
commit 3e3214fd9c858457554a51b04d161d4a2bb19738
Author: David Tardon <dtardon at redhat.com>
Date:   Tue Nov 4 16:51:52 2014 +0100

    coverity#706366 uncaught exception
    
    Change-Id: If89d6613394220fa4ca1da9b5b8820d9dbc205c7

diff --git a/connectivity/source/drivers/odbc/OResultSet.cxx b/connectivity/source/drivers/odbc/OResultSet.cxx
index a53e945..149a164 100644
--- a/connectivity/source/drivers/odbc/OResultSet.cxx
+++ b/connectivity/source/drivers/odbc/OResultSet.cxx
@@ -818,7 +818,7 @@ void SAL_CALL OResultSet::cancel(  ) throw(RuntimeException, std::exception)
     checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
 
 
-    OTools::ThrowException(m_pStatement->getOwnConnection(),N3SQLCancel(m_aStatementHandle),m_aStatementHandle,SQL_HANDLE_STMT,*this);
+    N3SQLCancel(m_aStatementHandle);
 }
 
 void SAL_CALL OResultSet::clearWarnings(  ) throw(SQLException, RuntimeException, std::exception)
commit f7f06f092ebf5a8a66b49a7380ea9f8a6553dbb5
Author: David Tardon <dtardon at redhat.com>
Date:   Tue Nov 4 16:47:39 2014 +0100

    coverity#706363 uncaught exception
    
    Change-Id: I2dde714f847f6df4d9b4ede744bef089a3715d7a

diff --git a/connectivity/source/drivers/odbc/ODatabaseMetaDataResultSet.cxx b/connectivity/source/drivers/odbc/ODatabaseMetaDataResultSet.cxx
index 79dce14..6762ecd 100644
--- a/connectivity/source/drivers/odbc/ODatabaseMetaDataResultSet.cxx
+++ b/connectivity/source/drivers/odbc/ODatabaseMetaDataResultSet.cxx
@@ -686,7 +686,7 @@ void SAL_CALL ODatabaseMetaDataResultSet::cancel(  ) throw(RuntimeException, std
     ::osl::MutexGuard aGuard( m_aMutex );
 
 
-    OTools::ThrowException(m_pConnection,N3SQLCancel(m_aStatementHandle),m_aStatementHandle,SQL_HANDLE_STMT,*this);
+    N3SQLCancel(m_aStatementHandle);
 }
 
 void SAL_CALL ODatabaseMetaDataResultSet::clearWarnings(  ) throw(SQLException, RuntimeException, std::exception)
commit 65d143de74c660ce8416b9f8700b0e7517464661
Author: David Tardon <dtardon at redhat.com>
Date:   Tue Nov 4 16:34:15 2014 +0100

    coverity#706362 uncaught exception
    
    Change-Id: I7200fe17c66cd904f0fc243bf8e33d6c24079729

diff --git a/connectivity/source/drivers/odbc/ODatabaseMetaData.cxx b/connectivity/source/drivers/odbc/ODatabaseMetaData.cxx
index 9c556fa..a06016f 100644
--- a/connectivity/source/drivers/odbc/ODatabaseMetaData.cxx
+++ b/connectivity/source/drivers/odbc/ODatabaseMetaData.cxx
@@ -1279,12 +1279,16 @@ sal_Int32 SAL_CALL ODatabaseMetaData::getDefaultTransactionIsolation(  ) throw(S
     return nValueTranslated;
 }
 
-sal_Int32 SAL_CALL ODatabaseMetaData::getDriverMinorVersion(  ) throw(RuntimeException, std::exception)
+sal_Int32 SAL_CALL ODatabaseMetaData::getDriverMinorVersion(  ) throw(RuntimeException, std::exception) try
 {
     OUString aValue;
     OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_DRIVER_VER,aValue,*this,m_pConnection->getTextEncoding());
     return aValue.copy(0,aValue.lastIndexOf('.')).toInt32();
 }
+catch (const SQLException &)
+{
+    return 0;
+}
 
 OUString SAL_CALL ODatabaseMetaData::getSQLKeywords(  ) throw(SQLException, RuntimeException, std::exception)
 {
commit 2a91eea8ae3c60f8193c6c3a61682c312077f915
Author: David Tardon <dtardon at redhat.com>
Date:   Tue Nov 4 16:33:15 2014 +0100

    coverity#706361 uncaught exception
    
    Change-Id: Iee569c32569339ec2eeb6ef038e5bdc83e541a8f

diff --git a/connectivity/source/drivers/odbc/ODatabaseMetaData.cxx b/connectivity/source/drivers/odbc/ODatabaseMetaData.cxx
index 56a2467..9c556fa 100644
--- a/connectivity/source/drivers/odbc/ODatabaseMetaData.cxx
+++ b/connectivity/source/drivers/odbc/ODatabaseMetaData.cxx
@@ -1243,12 +1243,16 @@ OUString SAL_CALL ODatabaseMetaData::getSchemaTerm(  ) throw(SQLException, Runti
     return aValue;
 }
 
-sal_Int32 SAL_CALL ODatabaseMetaData::getDriverMajorVersion(  ) throw(RuntimeException, std::exception)
+sal_Int32 SAL_CALL ODatabaseMetaData::getDriverMajorVersion(  ) throw(RuntimeException, std::exception) try
 {
     OUString aValue;
     OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_DRIVER_VER,aValue,*this,m_pConnection->getTextEncoding());
     return aValue.copy(0,aValue.indexOf('.')).toInt32();
 }
+catch (const SQLException &)
+{
+    return 0;
+}
 
 sal_Int32 SAL_CALL ODatabaseMetaData::getDefaultTransactionIsolation(  ) throw(SQLException, RuntimeException, std::exception)
 {
commit a16fcc537312e16677de988f7b4ba433943b469f
Author: David Tardon <dtardon at redhat.com>
Date:   Tue Nov 4 15:59:37 2014 +0100

    coverity#735660 coverity#735661 division by zero
    
    Change-Id: I86f503f740565bfef27a68636074a38d44046196

diff --git a/vcl/source/gdi/pdfwriter_impl.cxx b/vcl/source/gdi/pdfwriter_impl.cxx
index 04b4cea..5f6246b 100644
--- a/vcl/source/gdi/pdfwriter_impl.cxx
+++ b/vcl/source/gdi/pdfwriter_impl.cxx
@@ -10449,6 +10449,8 @@ void PDFWriterImpl::drawWallpaper( const Rectangle& rRect, const Wallpaper& rWal
                 m_aTilings.back().m_pTilingStream   = new SvMemoryStream();
                 m_aTilings.back().m_pTilingStream->Write( aTilingStream.getStr(), aTilingStream.getLength() );
                 // phase the tiling so wallpaper begins on upper left
+                if ((aConvertRect.GetWidth() == 0) || (aConvertRect.GetHeight() == 0))
+                    throw o3tl::divide_by_zero();
                 m_aTilings.back().m_aTransform.matrix[2] = double(aConvertRect.Left() % aConvertRect.GetWidth()) / fDivisor;
                 m_aTilings.back().m_aTransform.matrix[5] = double(aConvertRect.Top() % aConvertRect.GetHeight()) / fDivisor;
                 m_aTilings.back().m_aResources.m_aXObjects[aImageName] = rEmit.m_nObject;
commit 312244a590cba007ba70caf75c4d8d2ab6a385a1
Author: David Tardon <dtardon at redhat.com>
Date:   Tue Nov 4 15:46:13 2014 +0100

    coverity#735658 coverity#735659 division by zero
    
    Change-Id: I2e73cd105af7aa9d926659d3275bf10de9993d62

diff --git a/vcl/source/gdi/pdfwriter_impl.cxx b/vcl/source/gdi/pdfwriter_impl.cxx
index 40e5b7b..04b4cea 100644
--- a/vcl/source/gdi/pdfwriter_impl.cxx
+++ b/vcl/source/gdi/pdfwriter_impl.cxx
@@ -37,6 +37,7 @@
 #include <comphelper/string.hxx>
 #include <cppuhelper/implbase1.hxx>
 #include <i18nlangtag/languagetag.hxx>
+#include <o3tl/numeric.hxx>
 #include <osl/file.hxx>
 #include <osl/thread.h>
 #include <rtl/crc.h>
@@ -8971,6 +8972,9 @@ static double calcAngle( const Rectangle& rRect, const Point& rPoint )
     double fX = (double)aPoint.X();
     double fY = (double)-aPoint.Y();
 
+    if ((rRect.GetHeight() == 0) || (rRect.GetWidth() == 0))
+        throw o3tl::divide_by_zero();
+
     if( rRect.GetWidth() > rRect.GetHeight() )
         fY = fY*((double)rRect.GetWidth()/(double)rRect.GetHeight());
     else if( rRect.GetHeight() > rRect.GetWidth() )
commit c11c8f0a9bd2571c63b9a289b2d5de219de68a6b
Author: David Tardon <dtardon at redhat.com>
Date:   Tue Nov 4 15:42:00 2014 +0100

    coverity#735632 division by zero
    
    Change-Id: I756a701744998c306cc9630b604c20c44750e3b5

diff --git a/svx/source/engine3d/viewpt3d2.cxx b/svx/source/engine3d/viewpt3d2.cxx
index 02b7988..f59c25c 100644
--- a/svx/source/engine3d/viewpt3d2.cxx
+++ b/svx/source/engine3d/viewpt3d2.cxx
@@ -155,6 +155,8 @@ void Viewport3D::SetDeviceWindow(const Rectangle& rRect)
                 break;
             }
         case AS_HOLD_X:
+            if (nNewW == 0)
+                throw o3tl::divide_by_zero();
             // Adapt view height to view width
             fRatio = (double) nNewH / nNewW;
             fTmp = aViewWin.H;
commit 6718e5b1df2623b0a5e6c6f94ba891d5d55ad805
Author: David Tardon <dtardon at redhat.com>
Date:   Tue Nov 4 15:40:58 2014 +0100

    coverity#735631 division by zero
    
    Change-Id: I3082395b89c0ecc2ac754cf845ea7892ffea0a9b

diff --git a/svx/source/engine3d/viewpt3d2.cxx b/svx/source/engine3d/viewpt3d2.cxx
index 9deafdf..02b7988 100644
--- a/svx/source/engine3d/viewpt3d2.cxx
+++ b/svx/source/engine3d/viewpt3d2.cxx
@@ -19,6 +19,7 @@
 
 #include <svx/viewpt3d.hxx>
 #include <basegfx/range/b3drange.hxx>
+#include <o3tl/numeric.hxx>
 
 Viewport3D::Viewport3D() :
     aVRP(0, 0, 5),
@@ -162,6 +163,8 @@ void Viewport3D::SetDeviceWindow(const Rectangle& rRect)
             break;
 
         case AS_HOLD_Y:
+            if (nNewH == 0)
+                throw o3tl::divide_by_zero();
             // Adapt view width to view height
             fRatio = (double) nNewW / nNewH;
             fTmp = aViewWin.W;
commit 5978dd0d091fbe26eb3bb0612b70b49c376738d5
Author: David Tardon <dtardon at redhat.com>
Date:   Tue Nov 4 15:38:20 2014 +0100

    coverity#735629 coverity#735630 division by zero
    
    Change-Id: Ic243df16a59bcb9a90a655a70d2e21cae54ef930

diff --git a/svx/source/engine3d/obj3d.cxx b/svx/source/engine3d/obj3d.cxx
index 9e86153..eee59ad 100644
--- a/svx/source/engine3d/obj3d.cxx
+++ b/svx/source/engine3d/obj3d.cxx
@@ -17,6 +17,7 @@
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
 
+#include <o3tl/numeric.hxx>
 
 #include "svx/svdstr.hrc"
 #include "svdglob.hxx"
@@ -397,6 +398,9 @@ void E3dObject::NbcMove(const Size& rSize)
         basegfx::B3DRange aEyeVol(pScene->GetBoundVolume());
         aEyeVol.transform(aViewInfo3D.getOrientation());
 
+        if ((aRect.GetWidth() == 0) || (aRect.GetHeight() == 0))
+            throw o3tl::divide_by_zero();
+
         // build relative movement vector in eye coordinates
         basegfx::B3DPoint aMove(
             (double)rSize.Width() * aEyeVol.getWidth() / (double)aRect.GetWidth(),
commit 5f305a053291c8382d791297af95c8523fd98638
Author: David Tardon <dtardon at redhat.com>
Date:   Tue Nov 4 15:33:28 2014 +0100

    coverity#735627 coverity#735628 division by zero
    
    Change-Id: If5a1f749ffb57cd4f2f8d53094317c96a787bb33

diff --git a/svx/source/engine3d/dragmt3d.cxx b/svx/source/engine3d/dragmt3d.cxx
index ba4b9b6..39dd69f 100644
--- a/svx/source/engine3d/dragmt3d.cxx
+++ b/svx/source/engine3d/dragmt3d.cxx
@@ -19,6 +19,7 @@
 
 
 #include <dragmt3d.hxx>
+#include <o3tl/numeric.hxx>
 #include <svx/svdpagv.hxx>
 #include <svx/dialmgr.hxx>
 #include <svx/svddrgmt.hxx>
@@ -345,6 +346,8 @@ void E3dDragRotate::MoveSdrDrag(const Point& rPnt)
             }
             else
             {
+                if ((maFullBound.GetWidth() == 0) || (maFullBound.GetHeight() == 0))
+                    throw o3tl::divide_by_zero();
                 fWAngle = 90.0 * (double)(rPnt.X() - maLastPos.X())
                     / (double)maFullBound.GetWidth();
                 fHAngle = 90.0 * (double)(rPnt.Y() - maLastPos.Y())
commit 40240d33771f41310b0c7e7ba7f23a48105a0808
Author: David Tardon <dtardon at redhat.com>
Date:   Tue Nov 4 10:50:37 2014 +0100

    coverity#1202743 bad bit shift operation
    
    Change-Id: I9d1691fa2136bf8d6a0aaed69c4aff4e26c33c6b

diff --git a/include/vcl/salbtype.hxx b/include/vcl/salbtype.hxx
index 92258c5..9859aa3 100644
--- a/include/vcl/salbtype.hxx
+++ b/include/vcl/salbtype.hxx
@@ -744,6 +744,7 @@ inline long ColorMask::ImplCalcMaskShift( sal_uLong nMask, sal_uLong& rOr, sal_u
         nLen++;
     }
 
+    assert( nLen <= 8 ); // mask length must be 8 bits or less
     rOrShift = 8L - nLen;
     rOr = (sal_uInt8) ( ( 0xffUL >> nLen ) << rOrShift );
 


More information about the Libreoffice-commits mailing list