chart2/source/controller/dialogs/res_Trendline.cxx | 4 +-- comphelper/source/property/opropertybag.cxx | 2 - comphelper/source/property/propertybag.cxx | 19 ++++++++++++--- connectivity/source/drivers/dbase/DTable.cxx | 15 ++++++++++-- connectivity/source/inc/resource/dbase_res.hrc | 1 connectivity/source/resource/conn_shared_res.src | 6 ++++ offapi/com/sun/star/rdf/XDocumentRepository.idl | 1 ucb/source/ucp/gio/gio_content.cxx | 26 +++++++++++++++++++++ ucb/source/ucp/gio/gio_content.hxx | 3 ++ ucb/source/ucp/gio/gio_inputstream.cxx | 4 +-- ucb/source/ucp/gio/gio_outputstream.cxx | 4 +-- ucb/source/ucp/gio/gio_seekable.cxx | 6 ++-- unoxml/source/rdf/librdf_repository.cxx | 2 + vcl/source/filter/jpeg/Exif.cxx | 2 - vcl/source/gdi/cvtsvm.cxx | 3 ++ 15 files changed, 81 insertions(+), 17 deletions(-)
New commits: commit ccaaa544350156ed4cd113634ceb66ad8cc5af23 Author: Caolán McNamara <[email protected]> Date: Fri Oct 10 17:24:03 2014 +0100 coverity#707458 Uncaught exception Change-Id: Ia446cc0b8b26bb158b36ca64cbf45bf172f37bdf diff --git a/offapi/com/sun/star/rdf/XDocumentRepository.idl b/offapi/com/sun/star/rdf/XDocumentRepository.idl index 039e376..ff1ee9b 100644 --- a/offapi/com/sun/star/rdf/XDocumentRepository.idl +++ b/offapi/com/sun/star/rdf/XDocumentRepository.idl @@ -169,6 +169,7 @@ interface XDocumentRepository : XRepository com::sun::star::beans::Pair< sequence<Statement>, boolean > getStatementRDFa([in] XMetadatable Element) raises( com::sun::star::lang::IllegalArgumentException, + com::sun::star::container::NoSuchElementException, RepositoryException ); /** gets matching RDFa statements from the repository. diff --git a/unoxml/source/rdf/librdf_repository.cxx b/unoxml/source/rdf/librdf_repository.cxx index 2cdcdaa..dd0dec6 100644 --- a/unoxml/source/rdf/librdf_repository.cxx +++ b/unoxml/source/rdf/librdf_repository.cxx @@ -359,6 +359,7 @@ public: virtual beans::Pair< uno::Sequence<rdf::Statement>, sal_Bool > SAL_CALL getStatementRDFa(uno::Reference< rdf::XMetadatable > const& i_xElement) throw (uno::RuntimeException, lang::IllegalArgumentException, + container::NoSuchElementException, rdf::RepositoryException, std::exception) SAL_OVERRIDE; virtual uno::Reference< container::XEnumeration > SAL_CALL getStatementsRDFa( @@ -1646,6 +1647,7 @@ beans::Pair< uno::Sequence<rdf::Statement>, sal_Bool > SAL_CALL librdf_Repository::getStatementRDFa( const uno::Reference< rdf::XMetadatable > & i_xElement) throw (uno::RuntimeException, lang::IllegalArgumentException, + container::NoSuchElementException, rdf::RepositoryException, std::exception) { if (!i_xElement.is()) { commit cd86543fd4b81b03762e24d81be6c7671d5188a5 Author: Caolán McNamara <[email protected]> Date: Fri Oct 10 17:12:35 2014 +0100 coverity#1242714 Untrusted value as argument Change-Id: I1524722feae3ad9f67627cb34dec83632edefec4 diff --git a/vcl/source/filter/jpeg/Exif.cxx b/vcl/source/filter/jpeg/Exif.cxx index 01f0592..1a0f05b 100644 --- a/vcl/source/filter/jpeg/Exif.cxx +++ b/vcl/source/filter/jpeg/Exif.cxx @@ -124,7 +124,7 @@ bool Exif::processJpeg(SvStream& rStream, bool bSetValue) rStream.ReadUInt16( aLength ); - if (aLength < 8) + if (aLength < 8 || aLength > rStream.remainingSize()) { return false; } commit 6ec9b3a6301a73d5a5df038a39e7319e9ac43907 Author: Caolán McNamara <[email protected]> Date: Fri Oct 10 16:58:14 2014 +0100 coverity#1244944 experiment to silence Untrusted loop bound there's a warning for nPolygonCount but none for nPointCount. I wonder what happens if I tweak the code like this Change-Id: I7e1b02c4790f6b2d1c59e38de1a6a0b17a0485b1 diff --git a/vcl/source/gdi/cvtsvm.cxx b/vcl/source/gdi/cvtsvm.cxx index 2667f23..38a9b52 100644 --- a/vcl/source/gdi/cvtsvm.cxx +++ b/vcl/source/gdi/cvtsvm.cxx @@ -397,6 +397,9 @@ void ImplReadExtendedPolyPolygonAction(SvStream& rIStm, tools::PolyPolygon& rPol sal_uInt16 nPolygonCount(0); rIStm.ReadUInt16( nPolygonCount ); + if (!nPolygonCount) + return; + for(sal_uInt16 a(0); a < nPolygonCount; a++) { sal_uInt16 nPointCount(0); commit d1217a95ef16e662586b88c9f3c9a447eba41e46 Author: Caolán McNamara <[email protected]> Date: Fri Oct 10 16:37:37 2014 +0100 coverity#1223085 Unchecked return value there were three of these, not just one i.e. see also commit 276a051ef5dc144a202633779259a4ecd43c81a8 Date: Sun Oct 5 13:05:04 2014 -0500 coverity#1223085 Unchecked return value Change-Id: I07ee033ae31a346a08f68a6edfa480505fe6c11a diff --git a/chart2/source/controller/dialogs/res_Trendline.cxx b/chart2/source/controller/dialogs/res_Trendline.cxx index 77e972b..8c48e2a 100644 --- a/chart2/source/controller/dialogs/res_Trendline.cxx +++ b/chart2/source/controller/dialogs/res_Trendline.cxx @@ -265,11 +265,11 @@ bool TrendlineResources::FillItemSet(SfxItemSet* rOutAttrs) const sal_uInt32 nIndex = 0; double aValue = 0.0; - m_pNumFormatter->IsNumberFormat(m_pFmtFld_ExtrapolateForward->GetText(),nIndex,aValue); + (void)m_pNumFormatter->IsNumberFormat(m_pFmtFld_ExtrapolateForward->GetText(),nIndex,aValue); rOutAttrs->Put(SvxDoubleItem( aValue, SCHATTR_REGRESSION_EXTRAPOLATE_FORWARD ) ); aValue = 0.0; - m_pNumFormatter->IsNumberFormat(m_pFmtFld_ExtrapolateBackward->GetText(),nIndex,aValue); + (void)m_pNumFormatter->IsNumberFormat(m_pFmtFld_ExtrapolateBackward->GetText(),nIndex,aValue); rOutAttrs->Put(SvxDoubleItem( aValue, SCHATTR_REGRESSION_EXTRAPOLATE_BACKWARD ) ); if( m_pCB_SetIntercept->GetState() != TRISTATE_INDET ) commit 430e19e4f9c24985f855d5e607aaef63d110ddeb Author: Caolán McNamara <[email protected]> Date: Fri Oct 10 16:13:15 2014 +0100 coverity#1241375 Uncaught exception and coverity#1241356 Uncaught exception coverity#1241415 Uncaught exception coverity#1241449 Uncaught exception coverity#1241146 Uncaught exception coverity#1241169 Uncaught exception coverity#1241408 Uncaught exception coverity#1241452 Uncaught exception coverity#1241443 Uncaught exception coverity#1241236 Uncaught exception coverity#1241157 Uncaught exception coverity#1241283 Uncaught exception coverity#1241409 Uncaught exception coverity#1241229 Uncaught exception coverity#1241387 Uncaught exception coverity#1241050 Uncaught exception coverity#1241371 Uncaught exception coverity#1241048 Uncaught exception coverity#1241112 Uncaught exception coverity#1241351 Uncaught exception coverity#1241370 Uncaught exception coverity#1241329 Uncaught exception coverity#1241162 Uncaught exception coverity#1241103 Uncaught exception coverity#1241342 Uncaught exception coverity#1241271 Uncaught exception coverity#1241219 Uncaught exception coverity#1241245 Uncaught exception Change-Id: I3418bb54b5c385110201a99a339eba0d0d3048f5 diff --git a/ucb/source/ucp/gio/gio_content.cxx b/ucb/source/ucp/gio/gio_content.cxx index 2f71f03..96dbd72 100644 --- a/ucb/source/ucp/gio/gio_content.cxx +++ b/ucb/source/ucp/gio/gio_content.cxx @@ -33,6 +33,7 @@ #include <com/sun/star/io/XActiveDataSink.hpp> #include <com/sun/star/io/XOutputStream.hpp> #include <com/sun/star/lang/IllegalAccessException.hpp> +#include <com/sun/star/lang/WrappedTargetException.hpp> #include <com/sun/star/ucb/ContentInfoAttribute.hpp> #include <com/sun/star/ucb/InsertCommandArgument.hpp> #include <com/sun/star/ucb/InteractiveBadTransferURLException.hpp> @@ -58,6 +59,7 @@ #include <com/sun/star/ucb/XContentCreator.hpp> #include <comphelper/processfactory.hxx> +#include <cppuhelper/exc_hlp.hxx> #include <ucbhelper/contentidentifier.hxx> #include <ucbhelper/propertyvalueset.hxx> #include <ucbhelper/interactionrequest.hxx> @@ -283,6 +285,30 @@ uno::Any convertToException(GError *pError, const uno::Reference< uno::XInterfac return aRet; } +void convertToIOException(GError *pError, const uno::Reference< uno::XInterface >& rContext) + throw( io::IOException, uno::RuntimeException, std::exception ) +{ + try + { + convertToException(pError, rContext); + } + catch (const io::IOException&) + { + throw; + } + catch (const uno::RuntimeException&) + { + throw; + } + catch (const uno::Exception& e) + { + css::uno::Any a(cppu::getCaughtException()); + throw css::lang::WrappedTargetException( + "wrapped Exception " + e.Message, + css::uno::Reference<css::uno::XInterface>(), a); + } +} + uno::Any Content::mapGIOError( GError *pError ) { if (!pError) diff --git a/ucb/source/ucp/gio/gio_content.hxx b/ucb/source/ucp/gio/gio_content.hxx index fd40d20..ac42a66 100644 --- a/ucb/source/ucp/gio/gio_content.hxx +++ b/ucb/source/ucp/gio/gio_content.hxx @@ -56,6 +56,9 @@ namespace gio com::sun::star::uno::Any convertToException(GError *pError, const com::sun::star::uno::Reference< com::sun::star::uno::XInterface >& rContext, bool bThrow=true); +void convertToIOException(GError *pError, + const com::sun::star::uno::Reference< com::sun::star::uno::XInterface >& rContext) + throw (css::io::IOException, css::uno::RuntimeException, std::exception); class ContentProvider; class Content : public ::ucbhelper::ContentImplHelper, public com::sun::star::ucb::XContentCreator diff --git a/ucb/source/ucp/gio/gio_inputstream.cxx b/ucb/source/ucp/gio/gio_inputstream.cxx index 49b6b38..4a14f22 100644 --- a/ucb/source/ucp/gio/gio_inputstream.cxx +++ b/ucb/source/ucp/gio/gio_inputstream.cxx @@ -66,7 +66,7 @@ void SAL_CALL InputStream::skipBytes( sal_Int32 nBytesToSkip ) GError *pError=NULL; if (!g_seekable_seek(G_SEEKABLE(mpStream), nBytesToSkip, G_SEEK_CUR, NULL, &pError)) - convertToException(pError, static_cast< cppu::OWeakObject * >(this)); + convertToIOException(pError, static_cast< cppu::OWeakObject * >(this)); } sal_Int32 SAL_CALL InputStream::readBytes( uno::Sequence< sal_Int8 >& aData, sal_Int32 nBytesToRead ) @@ -88,7 +88,7 @@ sal_Int32 SAL_CALL InputStream::readBytes( uno::Sequence< sal_Int8 >& aData, sal gsize nBytesRead = 0; GError *pError=NULL; if (!g_input_stream_read_all(G_INPUT_STREAM(mpStream), aData.getArray(), nBytesToRead, &nBytesRead, NULL, &pError)) - convertToException(pError, static_cast< cppu::OWeakObject * >(this)); + convertToIOException(pError, static_cast< cppu::OWeakObject * >(this)); aData.realloc(nBytesRead); return nBytesRead; } diff --git a/ucb/source/ucp/gio/gio_outputstream.cxx b/ucb/source/ucp/gio/gio_outputstream.cxx index b4e4c12..d8cf60f 100644 --- a/ucb/source/ucp/gio/gio_outputstream.cxx +++ b/ucb/source/ucp/gio/gio_outputstream.cxx @@ -49,7 +49,7 @@ void SAL_CALL OutputStream::writeBytes( const com::sun::star::uno::Sequence< sal GError *pError=NULL; if (!g_output_stream_write_all(G_OUTPUT_STREAM(mpStream), rData.getConstArray(), rData.getLength(), NULL, NULL, &pError)) - convertToException(pError, static_cast< cppu::OWeakObject * >(this)); + convertToIOException(pError, static_cast< cppu::OWeakObject * >(this)); } void SAL_CALL OutputStream::flush( void ) @@ -61,7 +61,7 @@ void SAL_CALL OutputStream::flush( void ) GError *pError=NULL; if (!g_output_stream_flush(G_OUTPUT_STREAM(mpStream), NULL, &pError)) - convertToException(pError, static_cast< cppu::OWeakObject * >(this)); + convertToIOException(pError, static_cast< cppu::OWeakObject * >(this)); } void SAL_CALL OutputStream::closeOutput( void ) diff --git a/ucb/source/ucp/gio/gio_seekable.cxx b/ucb/source/ucp/gio/gio_seekable.cxx index ba338c0..940375d 100644 --- a/ucb/source/ucp/gio/gio_seekable.cxx +++ b/ucb/source/ucp/gio/gio_seekable.cxx @@ -51,7 +51,7 @@ void SAL_CALL Seekable::truncate( void ) GError *pError=NULL; if (!g_seekable_truncate(mpStream, 0, NULL, &pError)) - convertToException(pError, static_cast< cppu::OWeakObject * >(this)); + convertToIOException(pError, static_cast< cppu::OWeakObject * >(this)); } void SAL_CALL Seekable::seek( sal_Int64 location ) @@ -66,7 +66,7 @@ void SAL_CALL Seekable::seek( sal_Int64 location ) GError *pError=NULL; if (!g_seekable_seek(mpStream, location, G_SEEK_SET, NULL, &pError)) - convertToException(pError, static_cast< cppu::OWeakObject * >(this)); + convertToIOException(pError, static_cast< cppu::OWeakObject * >(this)); } sal_Int64 SAL_CALL Seekable::getPosition() throw( io::IOException, uno::RuntimeException, std::exception ) @@ -104,7 +104,7 @@ sal_Int64 SAL_CALL Seekable::getLength() throw( io::IOException, uno::RuntimeExc GError *pError=NULL; sal_Int64 nCurr = getPosition(); if (!g_seekable_seek(mpStream, 0, G_SEEK_END, NULL, &pError)) - convertToException(pError, static_cast< cppu::OWeakObject * >(this)); + convertToIOException(pError, static_cast< cppu::OWeakObject * >(this)); nSize = getPosition(); seek(nCurr); bOk = true; commit f5c8a636a644d4b74450de29f11399f3f69f55a7 Author: Caolán McNamara <[email protected]> Date: Fri Oct 10 15:53:35 2014 +0100 coverity#706302 Uncaught exception Change-Id: I082b7682124053948733efc2dbe5df6196acaa5f diff --git a/connectivity/source/drivers/dbase/DTable.cxx b/connectivity/source/drivers/dbase/DTable.cxx index 895f0de8..a98a54d 100644 --- a/connectivity/source/drivers/dbase/DTable.cxx +++ b/connectivity/source/drivers/dbase/DTable.cxx @@ -2256,8 +2256,19 @@ void ODbaseTable::alterColumn(sal_Int32 index, // now drop the old one if( DropImpl() ) // we don't want to delete the memo columns too { - // rename the new one to the old one - pNewTable->renameImpl(m_Name); + try + { + // rename the new one to the old one + pNewTable->renameImpl(m_Name); + } + catch(const css::container::ElementExistException&) + { + const OUString sError( getConnection()->getResources().getResourceStringWithSubstitution( + STR_COULD_NOT_DELETE_FILE, + "$filename$", m_Name + ) ); + ::dbtools::throwGenericSQLException( sError, *this ); + } // release the temp file pNewTable = NULL; ::comphelper::disposeComponent(xHoldTable); diff --git a/connectivity/source/inc/resource/dbase_res.hrc b/connectivity/source/inc/resource/dbase_res.hrc index 54f0232..d32caab 100644 --- a/connectivity/source/inc/resource/dbase_res.hrc +++ b/connectivity/source/inc/resource/dbase_res.hrc @@ -46,6 +46,7 @@ #define STR_INVALID_COLUMN_VALUE ( STR_DBASE_BASE + 18 ) #define STR_TABLE_NOT_DROP ( STR_DBASE_BASE + 19 ) #define STR_COULD_NOT_CREATE_INDEX_KEYSIZE ( STR_DBASE_BASE + 20 ) +#define STR_COULD_NOT_RENAME_FILE ( STR_DBASE_BASE + 21 ) #endif // CONNECTIVITY_RESOURCE_DBASE_HRC diff --git a/connectivity/source/resource/conn_shared_res.src b/connectivity/source/resource/conn_shared_res.src index 1d39e10..ad56436 100644 --- a/connectivity/source/resource/conn_shared_res.src +++ b/connectivity/source/resource/conn_shared_res.src @@ -398,11 +398,17 @@ String STR_SQL_NAME_ERROR { Text [ en-US ] = "The name '$name$' doesn't match SQL naming constraints."; }; + String STR_COULD_NOT_DELETE_FILE { Text [ en-US ] = "The file $filename$ could not be deleted."; }; +String STR_COULD_NOT_RENAME_FILE +{ + Text [ en-US ] = "The file could not be renamed to $filename$."; +}; + String STR_INVALID_COLUMN_TYPE { Text [ en-US ] = "Invalid column type for column '$columnname$'."; commit 9b92b4239e8d8d9657a0ba22959c7b0a99306870 Author: Caolán McNamara <[email protected]> Date: Fri Oct 10 15:47:34 2014 +0100 coverity#706285 Uncaught exception Change-Id: I6d7227a0614042f7a65520fc79b31afa3d7ca744 diff --git a/comphelper/source/property/propertybag.cxx b/comphelper/source/property/propertybag.cxx index 78e6a65..a822fdd 100644 --- a/comphelper/source/property/propertybag.cxx +++ b/comphelper/source/property/propertybag.cxx @@ -21,6 +21,7 @@ #include <com/sun/star/beans/IllegalTypeException.hpp> #include <com/sun/star/beans/PropertyExistException.hpp> +#include <com/sun/star/container/ElementExistException.hpp> #include <com/sun/star/lang/IllegalArgumentException.hpp> #include <com/sun/star/beans/PropertyAttribute.hpp> #include <com/sun/star/beans/NotRemoveableException.hpp> @@ -37,6 +38,7 @@ namespace comphelper using ::com::sun::star::uno::TypeClass_VOID; using ::com::sun::star::beans::IllegalTypeException; using ::com::sun::star::beans::PropertyExistException; + using ::com::sun::star::container::ElementExistException; using ::com::sun::star::lang::IllegalArgumentException; using ::com::sun::star::beans::Property; using ::com::sun::star::beans::NotRemoveableException; @@ -88,15 +90,24 @@ namespace comphelper ); } - void lcl_checkNameAndHandle( const OUString& _name, const sal_Int32 _handle, const PropertyBag& _container ) + void lcl_checkNameAndHandle_PropertyExistException( const OUString& _name, const sal_Int32 _handle, const PropertyBag& _container ) { if ( _container.hasPropertyByName( _name ) || _container.hasPropertyByHandle( _handle ) ) throw PropertyExistException( "Property name or handle already used.", - // TODO: resource NULL ); } + + void lcl_checkNameAndHandle_ElementExistException( const OUString& _name, const sal_Int32 _handle, const PropertyBag& _container ) + { + if ( _container.hasPropertyByName( _name ) || _container.hasPropertyByHandle( _handle ) ) + throw ElementExistException( + "Property name or handle already used.", + NULL ); + + } + } @@ -112,7 +123,7 @@ namespace comphelper // check name/handle sanity lcl_checkForEmptyName( m_pImpl->m_bAllowEmptyPropertyName, _rName ); - lcl_checkNameAndHandle( _rName, _nHandle, *this ); + lcl_checkNameAndHandle_ElementExistException( _rName, _nHandle, *this ); // register the property OSL_ENSURE( _nAttributes & PropertyAttribute::MAYBEVOID, "PropertyBag::addVoidProperty: this is for default-void properties only!" ); @@ -135,7 +146,7 @@ namespace comphelper // check name/handle sanity lcl_checkForEmptyName( m_pImpl->m_bAllowEmptyPropertyName, _rName ); - lcl_checkNameAndHandle( _rName, _nHandle, *this ); + lcl_checkNameAndHandle_PropertyExistException( _rName, _nHandle, *this ); // register the property registerPropertyNoMember( _rName, _nHandle, _nAttributes, aPropertyType, commit 0e06dbd3a0ab36dac81227c0cc16ec8c303f0585 Author: Caolán McNamara <[email protected]> Date: Fri Oct 10 15:38:27 2014 +0100 coverity#706284 Uncaught exception Change-Id: I748d34fd7f56b1c9c739f15fbb596932484195a4 diff --git a/comphelper/source/property/opropertybag.cxx b/comphelper/source/property/opropertybag.cxx index b3f3b27..1ef446d 100644 --- a/comphelper/source/property/opropertybag.cxx +++ b/comphelper/source/property/opropertybag.cxx @@ -248,7 +248,7 @@ namespace comphelper if ( !m_aAllowedTypes.empty() && m_aAllowedTypes.find( aProperty.Type ) == m_aAllowedTypes.end() ) - throw IllegalTypeException( OUString(), *this ); + throw IllegalArgumentException( OUString(), *this, 1 ); m_aDynamicProperties.addVoidProperty( aProperty.Name, aProperty.Type, findFreeHandle(), aProperty.Attributes );
_______________________________________________ Libreoffice-commits mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
