New Defects reported by Coverity Scan for LibreOffice

Stephan Bergmann sbergman at redhat.com
Mon Jan 23 09:03:50 UTC 2017


On 01/21/2017 01:47 AM, scan-admin at coverity.com wrote:
> 300 new defect(s) introduced to LibreOffice found with Coverity Scan.
> 21 defect(s), reported by Coverity Scan earlier, were marked fixed in the recent build analyzed by Coverity Scan.
>
> New defect(s) Reported-by: Coverity Scan
> Showing 20 of 300 defect(s)
>
>
> ** CID 1399404:  Error handling issues  (UNCAUGHT_EXCEPT)
> /sw/source/core/text/redlnitr.cxx: 185 in SwRedlineItr::~SwRedlineItr()()
>
>
> ________________________________________________________________________________________________________
> *** CID 1399404:  Error handling issues  (UNCAUGHT_EXCEPT)
> /sw/source/core/text/redlnitr.cxx: 185 in SwRedlineItr::~SwRedlineItr()()
> 179             pExt = new SwExtend( *pArr, nExtStart );
> 180         else
> 181             pExt = nullptr;
> 182         Seek (rFnt, 0, COMPLETE_STRING);
> 183     }
> 184
>>>>     CID 1399404:  Error handling issues  (UNCAUGHT_EXCEPT)
>>>>     An exception of type "com::sun::star::uno::RuntimeException" is thrown but the throw list "throw()" doesn't allow it to be thrown. This will cause a call to unexpected() which usually calls terminate().
> 185     SwRedlineItr::~SwRedlineItr()
> 186     {
> 187         Clear( nullptr );
> 188         delete pSet;
> 189         delete pExt;
> 190     }
>
> ** CID 1399403:  Error handling issues  (UNCAUGHT_EXCEPT)
> /sw/source/core/bastyp/calc.cxx: 364 in SwCalc::~SwCalc()()
>
>
> ________________________________________________________________________________________________________
> *** CID 1399403:  Error handling issues  (UNCAUGHT_EXCEPT)
> /sw/source/core/bastyp/calc.cxx: 364 in SwCalc::~SwCalc()()
> 358         nVal.PutString( rUserOptions.GetToken( aAdrToken[ 11 ] ));
> 359         sTmpStr = OUString::createFromAscii(sNTypeTab[25]);
> 360         m_aVarTable[ aHashValue[ 25 ] ]->pNext.reset( new SwCalcExp( sTmpStr, nVal, nullptr ) );
> 361
> 362     } // SwCalc::SwCalc
> 363
>>>>     CID 1399403:  Error handling issues  (UNCAUGHT_EXCEPT)
>>>>     An exception of type "std::length_error" is thrown but the throw list "throw()" doesn't allow it to be thrown. This will cause a call to unexpected() which usually calls terminate().
> 364     SwCalc::~SwCalc()
> 365     {
> 366         for(SwHash* p : m_aVarTable)
> 367             delete p;
> 368
> 369         if( m_pLocaleDataWrapper != m_aSysLocale.GetLocaleDataPtr() )

Looks like Coverity grew another less-than-helpful check here.

In the first example, 1399404, the check appears to be triggered by 
VirtualDevice::ImplInitVirDev (vcl/source/gdi/virdev.cxx) containing

>     if ( !mpVirDev )
>     {
>         // do not abort but throw an exception, may be the current thread terminates anyway (plugin-scenario)
>         throw css::uno::RuntimeException(
>             OUString( "Could not create system bitmap!" ),
>             css::uno::Reference< css::uno::XInterface >() );
>     }

and in the second example, 1399403, it appears to be triggered by 
rtl_uString_newConcatAsciiL (sal/rtl/ustring.cxx) containing

>     if (left->length > std::numeric_limits<sal_Int32>::max() - rightLength) {
>         throw std::length_error("rtl_uString_newConcatAsciiL");
>     }

(in each case, deeply nested from within the respective dtor code).

This appears to be irrespective of any (dynamic) exception 
specifications, so is unlikely to go away with the ongoing work for 
<https://lists.freedesktop.org/archives/libreoffice/2017-January/076665.html> 
"Dynamic Exception Specifications".


More information about the LibreOffice mailing list