New Defects reported by Coverity Scan for LibreOffice
scan-admin at coverity.com
scan-admin at coverity.com
Tue Feb 7 14:50:08 UTC 2023
Hi,
Please find the latest report on new defect(s) introduced to LibreOffice found with Coverity Scan.
6 new defect(s) introduced to LibreOffice found with Coverity Scan.
New defect(s) Reported-by: Coverity Scan
Showing 6 of 6 defect(s)
** CID 1520803: (CHECKED_RETURN)
/lingucomponent/source/spellcheck/languagetool/languagetoolimp.cxx: 441 in LanguageToolGrammarChecker::makeDudenHttpRequest[abi:cxx11](std::basic_string_view<char, std::char_traits<char>>, HTTP_METHOD, const rtl::OString &, long &)()
/lingucomponent/source/spellcheck/languagetool/languagetoolimp.cxx: 434 in LanguageToolGrammarChecker::makeDudenHttpRequest[abi:cxx11](std::basic_string_view<char, std::char_traits<char>>, HTTP_METHOD, const rtl::OString &, long &)()
/lingucomponent/source/spellcheck/languagetool/languagetoolimp.cxx: 426 in LanguageToolGrammarChecker::makeDudenHttpRequest[abi:cxx11](std::basic_string_view<char, std::char_traits<char>>, HTTP_METHOD, const rtl::OString &, long &)()
/lingucomponent/source/spellcheck/languagetool/languagetoolimp.cxx: 440 in LanguageToolGrammarChecker::makeDudenHttpRequest[abi:cxx11](std::basic_string_view<char, std::char_traits<char>>, HTTP_METHOD, const rtl::OString &, long &)()
/lingucomponent/source/spellcheck/languagetool/languagetoolimp.cxx: 424 in LanguageToolGrammarChecker::makeDudenHttpRequest[abi:cxx11](std::basic_string_view<char, std::char_traits<char>>, HTTP_METHOD, const rtl::OString &, long &)()
/lingucomponent/source/spellcheck/languagetool/languagetoolimp.cxx: 435 in LanguageToolGrammarChecker::makeDudenHttpRequest[abi:cxx11](std::basic_string_view<char, std::char_traits<char>>, HTTP_METHOD, const rtl::OString &, long &)()
/lingucomponent/source/spellcheck/languagetool/languagetoolimp.cxx: 429 in LanguageToolGrammarChecker::makeDudenHttpRequest[abi:cxx11](std::basic_string_view<char, std::char_traits<char>>, HTTP_METHOD, const rtl::OString &, long &)()
/lingucomponent/source/spellcheck/languagetool/languagetoolimp.cxx: 427 in LanguageToolGrammarChecker::makeDudenHttpRequest[abi:cxx11](std::basic_string_view<char, std::char_traits<char>>, HTTP_METHOD, const rtl::OString &, long &)()
/lingucomponent/source/spellcheck/languagetool/languagetoolimp.cxx: 428 in LanguageToolGrammarChecker::makeDudenHttpRequest[abi:cxx11](std::basic_string_view<char, std::char_traits<char>>, HTTP_METHOD, const rtl::OString &, long &)()
/lingucomponent/source/spellcheck/languagetool/languagetoolimp.cxx: 425 in LanguageToolGrammarChecker::makeDudenHttpRequest[abi:cxx11](std::basic_string_view<char, std::char_traits<char>>, HTTP_METHOD, const rtl::OString &, long &)()
________________________________________________________________________________________________________
*** CID 1520803: (CHECKED_RETURN)
/lingucomponent/source/spellcheck/languagetool/languagetoolimp.cxx: 441 in LanguageToolGrammarChecker::makeDudenHttpRequest[abi:cxx11](std::basic_string_view<char, std::char_traits<char>>, HTTP_METHOD, const rtl::OString &, long &)()
435 curl_easy_setopt(curl.get(), CURLOPT_SSL_VERIFYHOST, false);
436 }
437
438 if (method == HTTP_METHOD::HTTP_POST)
439 {
440 curl_easy_setopt(curl.get(), CURLOPT_POST, 1L);
>>> CID 1520803: (CHECKED_RETURN)
>>> Calling "curl_easy_setopt(curl.get(), CURLOPT_POSTFIELDS, aData->getStr())" without checking return value. This library function may fail and return an error code.
441 curl_easy_setopt(curl.get(), CURLOPT_POSTFIELDS, aData.getStr());
442 }
443
444 CURLcode cc = curl_easy_perform(curl.get());
445 if (cc != CURLE_OK)
446 {
/lingucomponent/source/spellcheck/languagetool/languagetoolimp.cxx: 434 in LanguageToolGrammarChecker::makeDudenHttpRequest[abi:cxx11](std::basic_string_view<char, std::char_traits<char>>, HTTP_METHOD, const rtl::OString &, long &)()
428 curl_easy_setopt(curl.get(), CURLOPT_WRITEFUNCTION, WriteCallback);
429 curl_easy_setopt(curl.get(), CURLOPT_WRITEDATA, static_cast<void*>(&sResponseBody));
430
431 // allow unknown or self-signed certificates
432 if (rLanguageOpts.getSSLVerification() == false)
433 {
>>> CID 1520803: (CHECKED_RETURN)
>>> Calling "curl_easy_setopt(curl.get(), CURLOPT_SSL_VERIFYPEER, 0)" without checking return value. This library function may fail and return an error code.
434 curl_easy_setopt(curl.get(), CURLOPT_SSL_VERIFYPEER, false);
435 curl_easy_setopt(curl.get(), CURLOPT_SSL_VERIFYHOST, false);
436 }
437
438 if (method == HTTP_METHOD::HTTP_POST)
439 {
/lingucomponent/source/spellcheck/languagetool/languagetoolimp.cxx: 426 in LanguageToolGrammarChecker::makeDudenHttpRequest[abi:cxx11](std::basic_string_view<char, std::char_traits<char>>, HTTP_METHOD, const rtl::OString &, long &)()
420 pList = curl_slist_append(pList, "Content-Type: application/json");
421 if (!sAccessToken.isEmpty())
422 pList = curl_slist_append(pList, sAccessToken.getStr());
423
424 curl_easy_setopt(curl.get(), CURLOPT_HTTPHEADER, pList);
425 curl_easy_setopt(curl.get(), CURLOPT_FAILONERROR, 1L);
>>> CID 1520803: (CHECKED_RETURN)
>>> Calling "curl_easy_setopt(curl.get(), CURLOPT_URL, aURL.data())" without checking return value. This library function may fail and return an error code.
426 curl_easy_setopt(curl.get(), CURLOPT_URL, aURL.data());
427 curl_easy_setopt(curl.get(), CURLOPT_TIMEOUT, CURL_TIMEOUT);
428 curl_easy_setopt(curl.get(), CURLOPT_WRITEFUNCTION, WriteCallback);
429 curl_easy_setopt(curl.get(), CURLOPT_WRITEDATA, static_cast<void*>(&sResponseBody));
430
431 // allow unknown or self-signed certificates
/lingucomponent/source/spellcheck/languagetool/languagetoolimp.cxx: 440 in LanguageToolGrammarChecker::makeDudenHttpRequest[abi:cxx11](std::basic_string_view<char, std::char_traits<char>>, HTTP_METHOD, const rtl::OString &, long &)()
434 curl_easy_setopt(curl.get(), CURLOPT_SSL_VERIFYPEER, false);
435 curl_easy_setopt(curl.get(), CURLOPT_SSL_VERIFYHOST, false);
436 }
437
438 if (method == HTTP_METHOD::HTTP_POST)
439 {
>>> CID 1520803: (CHECKED_RETURN)
>>> Calling "curl_easy_setopt(curl.get(), CURLOPT_POST, 1L)" without checking return value. This library function may fail and return an error code.
440 curl_easy_setopt(curl.get(), CURLOPT_POST, 1L);
441 curl_easy_setopt(curl.get(), CURLOPT_POSTFIELDS, aData.getStr());
442 }
443
444 CURLcode cc = curl_easy_perform(curl.get());
445 if (cc != CURLE_OK)
/lingucomponent/source/spellcheck/languagetool/languagetoolimp.cxx: 424 in LanguageToolGrammarChecker::makeDudenHttpRequest[abi:cxx11](std::basic_string_view<char, std::char_traits<char>>, HTTP_METHOD, const rtl::OString &, long &)()
418
419 pList = curl_slist_append(pList, "Cache-Control: no-cache");
420 pList = curl_slist_append(pList, "Content-Type: application/json");
421 if (!sAccessToken.isEmpty())
422 pList = curl_slist_append(pList, sAccessToken.getStr());
423
>>> CID 1520803: (CHECKED_RETURN)
>>> Calling "curl_easy_setopt(curl.get(), CURLOPT_HTTPHEADER, pList)" without checking return value. This library function may fail and return an error code.
424 curl_easy_setopt(curl.get(), CURLOPT_HTTPHEADER, pList);
425 curl_easy_setopt(curl.get(), CURLOPT_FAILONERROR, 1L);
426 curl_easy_setopt(curl.get(), CURLOPT_URL, aURL.data());
427 curl_easy_setopt(curl.get(), CURLOPT_TIMEOUT, CURL_TIMEOUT);
428 curl_easy_setopt(curl.get(), CURLOPT_WRITEFUNCTION, WriteCallback);
429 curl_easy_setopt(curl.get(), CURLOPT_WRITEDATA, static_cast<void*>(&sResponseBody));
/lingucomponent/source/spellcheck/languagetool/languagetoolimp.cxx: 435 in LanguageToolGrammarChecker::makeDudenHttpRequest[abi:cxx11](std::basic_string_view<char, std::char_traits<char>>, HTTP_METHOD, const rtl::OString &, long &)()
429 curl_easy_setopt(curl.get(), CURLOPT_WRITEDATA, static_cast<void*>(&sResponseBody));
430
431 // allow unknown or self-signed certificates
432 if (rLanguageOpts.getSSLVerification() == false)
433 {
434 curl_easy_setopt(curl.get(), CURLOPT_SSL_VERIFYPEER, false);
>>> CID 1520803: (CHECKED_RETURN)
>>> Calling "curl_easy_setopt(curl.get(), CURLOPT_SSL_VERIFYHOST, 0)" without checking return value. This library function may fail and return an error code.
435 curl_easy_setopt(curl.get(), CURLOPT_SSL_VERIFYHOST, false);
436 }
437
438 if (method == HTTP_METHOD::HTTP_POST)
439 {
440 curl_easy_setopt(curl.get(), CURLOPT_POST, 1L);
/lingucomponent/source/spellcheck/languagetool/languagetoolimp.cxx: 429 in LanguageToolGrammarChecker::makeDudenHttpRequest[abi:cxx11](std::basic_string_view<char, std::char_traits<char>>, HTTP_METHOD, const rtl::OString &, long &)()
423
424 curl_easy_setopt(curl.get(), CURLOPT_HTTPHEADER, pList);
425 curl_easy_setopt(curl.get(), CURLOPT_FAILONERROR, 1L);
426 curl_easy_setopt(curl.get(), CURLOPT_URL, aURL.data());
427 curl_easy_setopt(curl.get(), CURLOPT_TIMEOUT, CURL_TIMEOUT);
428 curl_easy_setopt(curl.get(), CURLOPT_WRITEFUNCTION, WriteCallback);
>>> CID 1520803: (CHECKED_RETURN)
>>> Calling "curl_easy_setopt(curl.get(), CURLOPT_WRITEDATA, static_cast<void *>(&sResponseBody))" without checking return value. This library function may fail and return an error code.
429 curl_easy_setopt(curl.get(), CURLOPT_WRITEDATA, static_cast<void*>(&sResponseBody));
430
431 // allow unknown or self-signed certificates
432 if (rLanguageOpts.getSSLVerification() == false)
433 {
434 curl_easy_setopt(curl.get(), CURLOPT_SSL_VERIFYPEER, false);
/lingucomponent/source/spellcheck/languagetool/languagetoolimp.cxx: 427 in LanguageToolGrammarChecker::makeDudenHttpRequest[abi:cxx11](std::basic_string_view<char, std::char_traits<char>>, HTTP_METHOD, const rtl::OString &, long &)()
421 if (!sAccessToken.isEmpty())
422 pList = curl_slist_append(pList, sAccessToken.getStr());
423
424 curl_easy_setopt(curl.get(), CURLOPT_HTTPHEADER, pList);
425 curl_easy_setopt(curl.get(), CURLOPT_FAILONERROR, 1L);
426 curl_easy_setopt(curl.get(), CURLOPT_URL, aURL.data());
>>> CID 1520803: (CHECKED_RETURN)
>>> Calling "curl_easy_setopt(curl.get(), CURLOPT_TIMEOUT, 10L)" without checking return value. This library function may fail and return an error code.
427 curl_easy_setopt(curl.get(), CURLOPT_TIMEOUT, CURL_TIMEOUT);
428 curl_easy_setopt(curl.get(), CURLOPT_WRITEFUNCTION, WriteCallback);
429 curl_easy_setopt(curl.get(), CURLOPT_WRITEDATA, static_cast<void*>(&sResponseBody));
430
431 // allow unknown or self-signed certificates
432 if (rLanguageOpts.getSSLVerification() == false)
/lingucomponent/source/spellcheck/languagetool/languagetoolimp.cxx: 428 in LanguageToolGrammarChecker::makeDudenHttpRequest[abi:cxx11](std::basic_string_view<char, std::char_traits<char>>, HTTP_METHOD, const rtl::OString &, long &)()
422 pList = curl_slist_append(pList, sAccessToken.getStr());
423
424 curl_easy_setopt(curl.get(), CURLOPT_HTTPHEADER, pList);
425 curl_easy_setopt(curl.get(), CURLOPT_FAILONERROR, 1L);
426 curl_easy_setopt(curl.get(), CURLOPT_URL, aURL.data());
427 curl_easy_setopt(curl.get(), CURLOPT_TIMEOUT, CURL_TIMEOUT);
>>> CID 1520803: (CHECKED_RETURN)
>>> Calling "curl_easy_setopt(curl.get(), CURLOPT_WRITEFUNCTION, WriteCallback)" without checking return value. This library function may fail and return an error code.
428 curl_easy_setopt(curl.get(), CURLOPT_WRITEFUNCTION, WriteCallback);
429 curl_easy_setopt(curl.get(), CURLOPT_WRITEDATA, static_cast<void*>(&sResponseBody));
430
431 // allow unknown or self-signed certificates
432 if (rLanguageOpts.getSSLVerification() == false)
433 {
/lingucomponent/source/spellcheck/languagetool/languagetoolimp.cxx: 425 in LanguageToolGrammarChecker::makeDudenHttpRequest[abi:cxx11](std::basic_string_view<char, std::char_traits<char>>, HTTP_METHOD, const rtl::OString &, long &)()
419 pList = curl_slist_append(pList, "Cache-Control: no-cache");
420 pList = curl_slist_append(pList, "Content-Type: application/json");
421 if (!sAccessToken.isEmpty())
422 pList = curl_slist_append(pList, sAccessToken.getStr());
423
424 curl_easy_setopt(curl.get(), CURLOPT_HTTPHEADER, pList);
>>> CID 1520803: (CHECKED_RETURN)
>>> Calling "curl_easy_setopt(curl.get(), CURLOPT_FAILONERROR, 1L)" without checking return value. This library function may fail and return an error code.
425 curl_easy_setopt(curl.get(), CURLOPT_FAILONERROR, 1L);
426 curl_easy_setopt(curl.get(), CURLOPT_URL, aURL.data());
427 curl_easy_setopt(curl.get(), CURLOPT_TIMEOUT, CURL_TIMEOUT);
428 curl_easy_setopt(curl.get(), CURLOPT_WRITEFUNCTION, WriteCallback);
429 curl_easy_setopt(curl.get(), CURLOPT_WRITEDATA, static_cast<void*>(&sResponseBody));
430
** CID 1520802: (NULL_RETURNS)
/desktop/source/lib/init.cxx: 7197 in <unnamed>::setLanguageToolConfig()()
/desktop/source/lib/init.cxx: 7193 in <unnamed>::setLanguageToolConfig()()
________________________________________________________________________________________________________
*** CID 1520802: (NULL_RETURNS)
/desktop/source/lib/init.cxx: 7197 in <unnamed>::setLanguageToolConfig()()
7191
7192 OUString aEnabled = OStringToOUString(pEnabled, RTL_TEXTENCODING_UTF8);
7193 OUString aSSLVerification = OStringToOUString(pSSLVerification, RTL_TEXTENCODING_UTF8);
7194 if (aEnabled != "true")
7195 return;
7196 OUString aBaseUrl = OStringToOUString(pBaseUrlString, RTL_TEXTENCODING_UTF8);
>>> CID 1520802: (NULL_RETURNS)
>>> Dereferencing a pointer that might be "nullptr" "pRestProtocol" when calling "basic_string_view". (The dereference is assumed on the basis of the "nonnull" parameter attribute.)
7197 OUString aRestProtocol = OStringToOUString(pRestProtocol, RTL_TEXTENCODING_UTF8);
7198 try
7199 {
7200 SvxLanguageToolOptions& rLanguageOpts = SvxLanguageToolOptions::Get();
7201 rLanguageOpts.setBaseURL(aBaseUrl);
7202 rLanguageOpts.setEnabled(true);
/desktop/source/lib/init.cxx: 7193 in <unnamed>::setLanguageToolConfig()()
7187 const char* pUsername = ::getenv("LANGUAGETOOL_USERNAME");
7188 const char* pApikey = ::getenv("LANGUAGETOOL_APIKEY");
7189 const char* pSSLVerification = ::getenv("LANGUAGETOOL_SSL_VERIFICATION");
7190 const char* pRestProtocol = ::getenv("LANGUAGETOOL_RESTPROTOCOL");
7191
7192 OUString aEnabled = OStringToOUString(pEnabled, RTL_TEXTENCODING_UTF8);
>>> CID 1520802: (NULL_RETURNS)
>>> Dereferencing a pointer that might be "nullptr" "pSSLVerification" when calling "basic_string_view". (The dereference is assumed on the basis of the "nonnull" parameter attribute.)
7193 OUString aSSLVerification = OStringToOUString(pSSLVerification, RTL_TEXTENCODING_UTF8);
7194 if (aEnabled != "true")
7195 return;
7196 OUString aBaseUrl = OStringToOUString(pBaseUrlString, RTL_TEXTENCODING_UTF8);
7197 OUString aRestProtocol = OStringToOUString(pRestProtocol, RTL_TEXTENCODING_UTF8);
7198 try
** CID 1520801: Null pointer dereferences (FORWARD_NULL)
________________________________________________________________________________________________________
*** CID 1520801: Null pointer dereferences (FORWARD_NULL)
/sd/source/ui/unoidl/unopage.cxx: 987 in SdGenericDrawPage::setPropertyValue(const rtl::OUString &, const com::sun::star::uno::Any &)()
981 {
982 SdrPage* pPage = GetPage();
983 uno::Reference<util::XTheme> xTheme;
984 if (aValue >>= xTheme)
985 {
986 auto* pUnoTheme = dynamic_cast<UnoTheme*>(xTheme.get());
>>> CID 1520801: Null pointer dereferences (FORWARD_NULL)
>>> Passing null pointer "pUnoTheme->getTheme()" to "Theme", which dereferences it.
987 std::unique_ptr<model::Theme> pTheme(new model::Theme(pUnoTheme->getTheme()));
988 pPage->getSdrPageProperties().SetTheme(std::move(pTheme));
989 }
990 break;
991 }
992
** CID 1520800: Null pointer dereferences (FORWARD_NULL)
________________________________________________________________________________________________________
*** CID 1520800: Null pointer dereferences (FORWARD_NULL)
/sw/source/core/layout/flycnt.cxx: 1602 in SwFrame::GetPrevFlyLeaf()()
1596 return static_cast<SwFlyAtContentFrame*>(SwFlowFrame::GetPrecede());
1597 }
1598
1599 SwLayoutFrame* SwFrame::GetPrevFlyLeaf()
1600 {
1601 auto pFly = dynamic_cast<SwFlyAtContentFrame*>(FindFlyFrame());
>>> CID 1520800: Null pointer dereferences (FORWARD_NULL)
>>> Passing null pointer "pFly" to "IsFlySplitAllowed", which dereferences it.
1602 if (!pFly->IsFlySplitAllowed())
1603 {
1604 return nullptr;
1605 }
1606
1607 return pFly->GetPrecede();
1608 }
1609
** CID 1520799: Null pointer dereferences (FORWARD_NULL)
________________________________________________________________________________________________________
*** CID 1520799: Null pointer dereferences (FORWARD_NULL)
/sw/source/core/unocore/unodraw.cxx: 409 in SwFmDrawPage::setPropertyValue(const rtl::OUString &, const com::sun::star::uno::Any &)()
403 {
404 SdrPage* pPage = GetSdrPage();
405 css::uno::Reference<css::util::XTheme> xTheme;
406 if (aValue >>= xTheme)
407 {
408 auto* pUnoTheme = dynamic_cast<UnoTheme*>(xTheme.get());
>>> CID 1520799: Null pointer dereferences (FORWARD_NULL)
>>> Passing null pointer "pUnoTheme->getTheme()" to "Theme", which dereferences it.
409 std::unique_ptr<model::Theme> pTheme(new model::Theme(pUnoTheme->getTheme()));
410 pPage->getSdrPageProperties().SetTheme(std::move(pTheme));
411 }
412 }
413 break;
414 case WID_PAGE_BOTTOM:
** CID 1520798: Memory - illegal accesses (USE_AFTER_FREE)
/sw/source/core/crsr/crstrvl.cxx: 859 in SwCursorShell::GotoFormatContentControl(const SwFormatContentControl &)()
________________________________________________________________________________________________________
*** CID 1520798: Memory - illegal accesses (USE_AFTER_FREE)
/sw/source/core/crsr/crstrvl.cxx: 859 in SwCursorShell::GotoFormatContentControl(const SwFormatContentControl &)()
853 sal_Int32 nEnd = *pTextContentControl->End() - 1;
854 pCursor->GetMark()->Assign(*pTextNode, nEnd);
855 }
856 else
857 ClearMark();
858
>>> CID 1520798: Memory - illegal accesses (USE_AFTER_FREE)
>>> Calling "IsSelOvr" dereferences freed pointer "pCursor". (The dereference happens because this is a virtual function call.)
859 bool bRet = !pCursor->IsSelOvr();
860 if (bRet)
861 {
862 UpdateCursor(SwCursorShell::SCROLLWIN | SwCursorShell::CHKRANGE
863 | SwCursorShell::READONLY);
864 }
________________________________________________________________________________________________________
To view the defects in Coverity Scan visit, https://u15810271.ct.sendgrid.net/ls/click?upn=HRESupC-2F2Czv4BOaCWWCy7my0P0qcxCbhZ31OYv50ypSs1kiFPuCn2xFdlMIFBirii0zZ9j2-2F9F2XPBcBm2BNgi9duPy3v-2FzgFDd2LJ-2BDKI-3D3jKj_OTq2XUZbbipYjyLSo6GRo-2FpVxQ9OzkDINu9UTS-2FQhSdO0F0jQniitrGlNxDIzPJiZXS5Uj1o26D-2Ff0LUvzr6APaVkYCpKn9rMH2gSXXpCdlAZQjeOVfy7hnnqHKZVuEsmHBpjF1rIHi0ot-2BY6xaf-2FK7lGWFhbA56kmvJchHDbH5F2QwPjpB8rcWR6qegAMifWTY3Sw9sJ8P9yjVl-2Fp-2Fx2TL-2BaTnHLeUFIexPLiTfQZE-3D
More information about the LibreOffice
mailing list