New Defects reported by Coverity Scan for LibreOffice
scan-admin at coverity.com
scan-admin at coverity.com
Fri Oct 14 14:13:04 UTC 2022
Hi,
Please find the latest report on new defect(s) introduced to LibreOffice found with Coverity Scan.
1 new defect(s) introduced to LibreOffice found with Coverity Scan.
New defect(s) Reported-by: Coverity Scan
Showing 1 of 1 defect(s)
** CID 1515996: (CHECKED_RETURN)
/linguistic/source/translate.cxx: 19 in linguistic::Translate(const rtl::OString &, const rtl::OString &, const rtl::OString &, const rtl::OString &)()
/linguistic/source/translate.cxx: 24 in linguistic::Translate(const rtl::OString &, const rtl::OString &, const rtl::OString &, const rtl::OString &)()
/linguistic/source/translate.cxx: 33 in linguistic::Translate(const rtl::OString &, const rtl::OString &, const rtl::OString &, const rtl::OString &)()
/linguistic/source/translate.cxx: 39 in linguistic::Translate(const rtl::OString &, const rtl::OString &, const rtl::OString &, const rtl::OString &)()
/linguistic/source/translate.cxx: 21 in linguistic::Translate(const rtl::OString &, const rtl::OString &, const rtl::OString &, const rtl::OString &)()
/linguistic/source/translate.cxx: 20 in linguistic::Translate(const rtl::OString &, const rtl::OString &, const rtl::OString &, const rtl::OString &)()
________________________________________________________________________________________________________
*** CID 1515996: (CHECKED_RETURN)
/linguistic/source/translate.cxx: 19 in linguistic::Translate(const rtl::OString &, const rtl::OString &, const rtl::OString &, const rtl::OString &)()
13 const OString& rData)
14 {
15 constexpr tools::Long CURL_TIMEOUT = 10L;
16
17 std::unique_ptr<CURL, std::function<void(CURL*)>> curl(curl_easy_init(),
18 [](CURL* p) { curl_easy_cleanup(p); });
>>> CID 1515996: (CHECKED_RETURN)
>>> Calling "curl_easy_setopt(curl.get(), CURLOPT_URL, rAPIUrl->getStr())" without checking return value. This library function may fail and return an error code.
19 curl_easy_setopt(curl.get(), CURLOPT_URL, rAPIUrl.getStr());
20 curl_easy_setopt(curl.get(), CURLOPT_FAILONERROR, 1L);
21 curl_easy_setopt(curl.get(), CURLOPT_TIMEOUT, CURL_TIMEOUT);
22
23 std::string response_body;
24 curl_easy_setopt(curl.get(), CURLOPT_WRITEFUNCTION,
/linguistic/source/translate.cxx: 24 in linguistic::Translate(const rtl::OString &, const rtl::OString &, const rtl::OString &, const rtl::OString &)()
18 [](CURL* p) { curl_easy_cleanup(p); });
19 curl_easy_setopt(curl.get(), CURLOPT_URL, rAPIUrl.getStr());
20 curl_easy_setopt(curl.get(), CURLOPT_FAILONERROR, 1L);
21 curl_easy_setopt(curl.get(), CURLOPT_TIMEOUT, CURL_TIMEOUT);
22
23 std::string response_body;
>>> CID 1515996: (CHECKED_RETURN)
>>> Calling "curl_easy_setopt(curl.get(), CURLOPT_WRITEFUNCTION, +linguistic::Translate(rtl::OString const &, rtl::OString const &, rtl::OString const &, rtl::OString const &)::[lambda(void *, unsigned long, unsigned long, void *) (instance 1)]().operator size_t (*)(void *, size_t, size_t, void *)())" without checking return value. This library function may fail and return an error code.
24 curl_easy_setopt(curl.get(), CURLOPT_WRITEFUNCTION,
25 +[](void* buffer, size_t size, size_t nmemb, void* userp) -> size_t {
26 if (!userp)
27 return 0;
28 std::string* response = static_cast<std::string*>(userp);
29 size_t real_size = size * nmemb;
/linguistic/source/translate.cxx: 33 in linguistic::Translate(const rtl::OString &, const rtl::OString &, const rtl::OString &, const rtl::OString &)()
27 return 0;
28 std::string* response = static_cast<std::string*>(userp);
29 size_t real_size = size * nmemb;
30 response->append(static_cast<char*>(buffer), real_size);
31 return real_size;
32 });
>>> CID 1515996: (CHECKED_RETURN)
>>> Calling "curl_easy_setopt(curl.get(), CURLOPT_WRITEDATA, static_cast<void *>(&response_body))" without checking return value. This library function may fail and return an error code.
33 curl_easy_setopt(curl.get(), CURLOPT_WRITEDATA, static_cast<void*>(&response_body));
34 OString aLang(curl_easy_escape(curl.get(), rTargetLang.getStr(), rTargetLang.getLength()));
35 OString aAuthKey(curl_easy_escape(curl.get(), rAuthKey.getStr(), rAuthKey.getLength()));
36 OString aData(curl_easy_escape(curl.get(), rData.getStr(), rData.getLength()));
37 OString aPostData("auth_key=" + aAuthKey + "&target_lang=" + aLang + "&text=" + aData);
38
/linguistic/source/translate.cxx: 39 in linguistic::Translate(const rtl::OString &, const rtl::OString &, const rtl::OString &, const rtl::OString &)()
33 curl_easy_setopt(curl.get(), CURLOPT_WRITEDATA, static_cast<void*>(&response_body));
34 OString aLang(curl_easy_escape(curl.get(), rTargetLang.getStr(), rTargetLang.getLength()));
35 OString aAuthKey(curl_easy_escape(curl.get(), rAuthKey.getStr(), rAuthKey.getLength()));
36 OString aData(curl_easy_escape(curl.get(), rData.getStr(), rData.getLength()));
37 OString aPostData("auth_key=" + aAuthKey + "&target_lang=" + aLang + "&text=" + aData);
38
>>> CID 1515996: (CHECKED_RETURN)
>>> Calling "curl_easy_setopt(curl.get(), CURLOPT_POSTFIELDS, aPostData.getStr())" without checking return value. This library function may fail and return an error code.
39 curl_easy_setopt(curl.get(), CURLOPT_POSTFIELDS, aPostData.getStr());
40 CURLcode cc = curl_easy_perform(curl.get());
41 if (cc != CURLE_OK)
42 {
43 SAL_WARN("linguistic",
44 "Translate: CURL perform returned with error: " << static_cast<sal_Int32>(cc));
/linguistic/source/translate.cxx: 21 in linguistic::Translate(const rtl::OString &, const rtl::OString &, const rtl::OString &, const rtl::OString &)()
15 constexpr tools::Long CURL_TIMEOUT = 10L;
16
17 std::unique_ptr<CURL, std::function<void(CURL*)>> curl(curl_easy_init(),
18 [](CURL* p) { curl_easy_cleanup(p); });
19 curl_easy_setopt(curl.get(), CURLOPT_URL, rAPIUrl.getStr());
20 curl_easy_setopt(curl.get(), CURLOPT_FAILONERROR, 1L);
>>> CID 1515996: (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.
21 curl_easy_setopt(curl.get(), CURLOPT_TIMEOUT, CURL_TIMEOUT);
22
23 std::string response_body;
24 curl_easy_setopt(curl.get(), CURLOPT_WRITEFUNCTION,
25 +[](void* buffer, size_t size, size_t nmemb, void* userp) -> size_t {
26 if (!userp)
/linguistic/source/translate.cxx: 20 in linguistic::Translate(const rtl::OString &, const rtl::OString &, const rtl::OString &, const rtl::OString &)()
14 {
15 constexpr tools::Long CURL_TIMEOUT = 10L;
16
17 std::unique_ptr<CURL, std::function<void(CURL*)>> curl(curl_easy_init(),
18 [](CURL* p) { curl_easy_cleanup(p); });
19 curl_easy_setopt(curl.get(), CURLOPT_URL, rAPIUrl.getStr());
>>> CID 1515996: (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.
20 curl_easy_setopt(curl.get(), CURLOPT_FAILONERROR, 1L);
21 curl_easy_setopt(curl.get(), CURLOPT_TIMEOUT, CURL_TIMEOUT);
22
23 std::string response_body;
24 curl_easy_setopt(curl.get(), CURLOPT_WRITEFUNCTION,
25 +[](void* buffer, size_t size, size_t nmemb, void* userp) -> size_t {
________________________________________________________________________________________________________
To view the defects in Coverity Scan visit, https://u15810271.ct.sendgrid.net/ls/click?upn=HRESupC-2F2Czv4BOaCWWCy7my0P0qcxCbhZ31OYv50ypSs1kiFPuCn2xFdlMIFBirii0zZ9j2-2F9F2XPBcBm2BNgi9duPy3v-2FzgFDd2LJ-2BDKI-3DGiv8_OTq2XUZbbipYjyLSo6GRo-2FpVxQ9OzkDINu9UTS-2FQhSdO0F0jQniitrGlNxDIzPJiE3abuAxLOjq564Ht7O1XHUJaW1GJ48vF2E5tTJwrJk8GYeLSlMfaFHX-2FCv5UsO2C7TzdROD3JShLyWCBh0qOLGmrzahvlKjiUDGAfcWg2DYFirlkWV6jaxys659MmObiTZDYTy-2BJWfPZSdH6wQCUsayUgLYN0tzNOKXOF0wy6LU-3D
More information about the LibreOffice
mailing list