New Defects reported by Coverity Scan for LibreOffice

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

Please find the latest report on new defect(s) introduced to LibreOffice found with Coverity Scan.

123 new defect(s) introduced to LibreOffice found with Coverity Scan.
565 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 123 defect(s)


** CID 1533655:  Security best practices violations  (DC.WEAK_CRYPTO)
/tools/Replay.hpp: 214 in StressSocketHandler::StressSocketHandler(SocketPoll &, std::shared_ptr<Stats>, const std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> &, const std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> &, int)()


________________________________________________________________________________________________________
*** CID 1533655:  Security best practices violations  (DC.WEAK_CRYPTO)
/tools/Replay.hpp: 214 in StressSocketHandler::StressSocketHandler(SocketPoll &, std::shared_ptr<Stats>, const std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> &, const std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> &, int)()
208         {
209             static std::atomic<int> number;
210             _logPre = "[" + std::to_string(++number) + "] ";
211             std::cerr << "Attempt connect to " << uri << " for trace " << _trace << "\n";
212             getNextRecord();
213             _start = std::chrono::steady_clock::now() + std::chrono::milliseconds(delayMs);
>>>     CID 1533655:  Security best practices violations  (DC.WEAK_CRYPTO)
>>>     "rand" should not be used for security-related applications, because linear congruential algorithms are too easy to break.
214             _nextPing = _start + std::chrono::milliseconds((long)(std::rand() * 1000.0) / RAND_MAX);
215             _lastTile = _start;
216         }
217     
218         void gotPing(WSOpCode /* code */, int pingTimeUs) override
219         {

** CID 1533654:  API usage errors  (INVALIDATE_ITERATOR)
/test/WopiTestServer.hpp: 519 in WopiTestServer::assertTargetTest(const Poco::URI &)()


________________________________________________________________________________________________________
*** CID 1533654:  API usage errors  (INVALIDATE_ITERATOR)
/test/WopiTestServer.hpp: 519 in WopiTestServer::assertTargetTest(const Poco::URI &)()
513             const auto testnameIt = std::find_if(params.begin(), params.end(),
514                                                  [](const std::pair<std::string, std::string>& pair)
515                                                  { return pair.first == "testname"; });
516     
517             LOK_ASSERT_MESSAGE_SILENT("Request belongs to an unknown test", testnameIt != params.end());
518     
>>>     CID 1533654:  API usage errors  (INVALIDATE_ITERATOR)
>>>     Dereferencing iterator "testnameIt" though it is already past the end of its container.
519             const std::string target = StringVector::tokenize(testnameIt->second, '/')[0];
520             LOK_ASSERT_EQUAL_MESSAGE("Request belongs to a different test", getTestname(), target);
521         }
522     
523         /// Here we act as a WOPI server, so that we have a server that responds to
524         /// the wopi requests without additional expensive setup.

** CID 1533653:  Performance inefficiencies  (COPY_INSTEAD_OF_MOVE)
/wsd/DocumentBroker.cpp: 3944 in RenderSearchResultBroker::handleInput(const std::shared_ptr<Message> &)()


________________________________________________________________________________________________________
*** CID 1533653:  Performance inefficiencies  (COPY_INSTEAD_OF_MOVE)
/wsd/DocumentBroker.cpp: 3944 in RenderSearchResultBroker::handleInput(const std::shared_ptr<Message> &)()
3938                     _aResposeData.resize(messageData.size() - commandStringVector.size());
3939                     std::copy(messageData.begin() + commandStringVector.size(), messageData.end(), _aResposeData.begin());
3940     
3941                     std::string aDataString(_aResposeData.data(), _aResposeData.size());
3942                     // really not ideal that the response works only with std::string
3943                     http::Response httpResponse(http::StatusCode::OK);
>>>     CID 1533653:  Performance inefficiencies  (COPY_INSTEAD_OF_MOVE)
>>>     "aDataString" is passed-by-value as parameter to "setBody" when it could be moved instead.
3944                     httpResponse.setBody(aDataString, "image/png");
3945                     httpResponse.set("Connection", "close");
3946                     _socket->sendAndShutdown(httpResponse);
3947     
3948                     removeSession(_clientSession);
3949                     stop("Finished RenderSearchResult handler.");

** CID 1533652:  Performance inefficiencies  (PASS_BY_VALUE)
/wsd/Storage.hpp: 440 in StorageBase::sanitizeUri(Poco::URI)()


________________________________________________________________________________________________________
*** CID 1533652:  Performance inefficiencies  (PASS_BY_VALUE)
/wsd/Storage.hpp: 440 in StorageBase::sanitizeUri(Poco::URI)()
434         static Poco::Net::HTTPClientSession* getHTTPClientSession(const Poco::URI& uri);
435         static std::shared_ptr<http::Session> getHttpSession(const Poco::URI& uri);
436     
437     protected:
438     
439         /// Sanitize a URI by removing authorization tokens.
>>>     CID 1533652:  Performance inefficiencies  (PASS_BY_VALUE)
>>>     Passing parameter uri of type "Poco::URI" (size 200 bytes) by value, which exceeds the low threshold of 128 bytes.
440         Poco::URI sanitizeUri(Poco::URI uri)
441         {
442             static const std::string access_token("access_token");
443     
444             Poco::URI::QueryParameters queryParams = uri.getQueryParameters();
445             for (auto& param : queryParams)

** CID 1533651:  Error handling issues  (UNCAUGHT_EXCEPT)
/wsd/COOLWSD.cpp: 6020 in COOLWSD::main(const std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>> &)()


________________________________________________________________________________________________________
*** CID 1533651:  Error handling issues  (UNCAUGHT_EXCEPT)
/wsd/COOLWSD.cpp: 6020 in COOLWSD::main(const std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>> &)()
6014         catch (const std::exception& ex)
6015         {
6016             LOG_ERR("Failed to uninitialize: " << ex.what());
6017         }
6018     }
6019     
>>>     CID 1533651:  Error handling issues  (UNCAUGHT_EXCEPT)
>>>     In function "COOLWSD::main(std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > const &)" an exception of type "std::runtime_error" is thrown and never caught.
6020     int COOLWSD::main(const std::vector<std::string>& /*args*/)
6021     {
6022     #if MOBILEAPP && !defined IOS
6023         SigUtil::resetTerminationFlags();
6024     #endif
6025     

** CID 1533650:  Performance inefficiencies  (PASS_BY_VALUE)
/wsd/Storage.cpp: 647 in WopiStorage::getWOPIFileInfoForUri(Poco::URI, const Authorization &, LockContext &, unsigned int)()


________________________________________________________________________________________________________
*** CID 1533650:  Performance inefficiencies  (PASS_BY_VALUE)
/wsd/Storage.cpp: 647 in WopiStorage::getWOPIFileInfoForUri(Poco::URI, const Authorization &, LockContext &, unsigned int)()
641         }
642     
643         return httpRequest;
644     }
645     
646     std::unique_ptr<WopiStorage::WOPIFileInfo>
>>>     CID 1533650:  Performance inefficiencies  (PASS_BY_VALUE)
>>>     Passing parameter uriObject of type "Poco::URI" (size 200 bytes) by value, which exceeds the low threshold of 128 bytes.
647     WopiStorage::getWOPIFileInfoForUri(Poco::URI uriObject, const Authorization& auth,
648                                        LockContext& lockCtx, unsigned redirectLimit)
649     {
650         ProfileZone profileZone("WopiStorage::getWOPIFileInfo", { {"url", _fileUrl} });
651     
652         // update the access_token to the one matching to the session

** CID 1533649:  Memory - corruptions  (OVERRUN)


________________________________________________________________________________________________________
*** CID 1533649:  Memory - corruptions  (OVERRUN)
/net/Socket.hpp: 1143 in StreamSocket::readIncomingData()()
1137     
1138                 if (len > 0)
1139                 {
1140                     LOG_ASSERT_MSG(len <= ssize_t(sizeof(buf)),
1141                                    "Read more data than the buffer size");
1142                     _bytesRecvd += len;
>>>     CID 1533649:  Memory - corruptions  (OVERRUN)
>>>     Overrunning buffer pointed to by "&buf[0]" of 16384 bytes by passing it to a function which accesses it at byte offset 16384 using argument "len" (which evaluates to 16385).
1143                     _inBuffer.append(&buf[0], len);
1144                 }
1145                 // else poll will handle errors.
1146             }
1147             while (len == (sizeof(buf)));
1148     

** CID 1533648:  Error handling issues  (UNCAUGHT_EXCEPT)
/tools/WebSocketDump.cpp: 223 in main()


________________________________________________________________________________________________________
*** CID 1533648:  Error handling issues  (UNCAUGHT_EXCEPT)
/tools/WebSocketDump.cpp: 223 in main()
217     {
218     public:
219         CoolConfig()
220             {}
221     };
222     
>>>     CID 1533648:  Error handling issues  (UNCAUGHT_EXCEPT)
>>>     In function "main(int, char **)" an exception of type "Poco::NullPointerException" is thrown and never caught.
223     int main (int argc, char **argv)
224     {
225         (void) argc; (void) argv;
226     
227         if (!UnitWSD::init(UnitWSD::UnitType::Wsd, ""))
228         {

** CID 1533647:    (UNCAUGHT_EXCEPT)
/kit/ForKit.cpp: 481 in main()
/kit/ForKit.cpp: 481 in main()
/kit/ForKit.cpp: 481 in main()
/kit/ForKit.cpp: 481 in main()
/kit/ForKit.cpp: 481 in main()


________________________________________________________________________________________________________
*** CID 1533647:    (UNCAUGHT_EXCEPT)
/kit/ForKit.cpp: 481 in main()
475         std::cout << "  Single-threaded process that spawns lok instances" << std::endl;
476         std::cout << "  Note: Running this standalone is not possible. It is spawned by coolwsd" << std::endl;
477         std::cout << "        and is controlled via a pipe." << std::endl;
478         std::cout << "" << std::endl;
479     }
480     
>>>     CID 1533647:    (UNCAUGHT_EXCEPT)
>>>     In function "main(int, char **)" an exception of type "std::runtime_error" is thrown and never caught.
481     int main(int argc, char** argv)
482     {
483         /*WARNING: PRIVILEGED CODE CHECKING START */
484     
485         /*WARNING*/ // early check for avoiding the security check for username 'cool'
486         /*WARNING*/ // (deliberately only this, not moving the entire parameter parsing here)
/kit/ForKit.cpp: 481 in main()
475         std::cout << "  Single-threaded process that spawns lok instances" << std::endl;
476         std::cout << "  Note: Running this standalone is not possible. It is spawned by coolwsd" << std::endl;
477         std::cout << "        and is controlled via a pipe." << std::endl;
478         std::cout << "" << std::endl;
479     }
480     
>>>     CID 1533647:    (UNCAUGHT_EXCEPT)
>>>     In function "main(int, char **)" an exception of type "std::runtime_error" is thrown and never caught.
481     int main(int argc, char** argv)
482     {
483         /*WARNING: PRIVILEGED CODE CHECKING START */
484     
485         /*WARNING*/ // early check for avoiding the security check for username 'cool'
486         /*WARNING*/ // (deliberately only this, not moving the entire parameter parsing here)
/kit/ForKit.cpp: 481 in main()
475         std::cout << "  Single-threaded process that spawns lok instances" << std::endl;
476         std::cout << "  Note: Running this standalone is not possible. It is spawned by coolwsd" << std::endl;
477         std::cout << "        and is controlled via a pipe." << std::endl;
478         std::cout << "" << std::endl;
479     }
480     
>>>     CID 1533647:    (UNCAUGHT_EXCEPT)
>>>     In function "main(int, char **)" an exception of type "std::runtime_error" is thrown and never caught.
481     int main(int argc, char** argv)
482     {
483         /*WARNING: PRIVILEGED CODE CHECKING START */
484     
485         /*WARNING*/ // early check for avoiding the security check for username 'cool'
486         /*WARNING*/ // (deliberately only this, not moving the entire parameter parsing here)
/kit/ForKit.cpp: 481 in main()
475         std::cout << "  Single-threaded process that spawns lok instances" << std::endl;
476         std::cout << "  Note: Running this standalone is not possible. It is spawned by coolwsd" << std::endl;
477         std::cout << "        and is controlled via a pipe." << std::endl;
478         std::cout << "" << std::endl;
479     }
480     
>>>     CID 1533647:    (UNCAUGHT_EXCEPT)
>>>     In function "main(int, char **)" an exception of type "std::runtime_error" is thrown and never caught.
481     int main(int argc, char** argv)
482     {
483         /*WARNING: PRIVILEGED CODE CHECKING START */
484     
485         /*WARNING*/ // early check for avoiding the security check for username 'cool'
486         /*WARNING*/ // (deliberately only this, not moving the entire parameter parsing here)
/kit/ForKit.cpp: 481 in main()
475         std::cout << "  Single-threaded process that spawns lok instances" << std::endl;
476         std::cout << "  Note: Running this standalone is not possible. It is spawned by coolwsd" << std::endl;
477         std::cout << "        and is controlled via a pipe." << std::endl;
478         std::cout << "" << std::endl;
479     }
480     
>>>     CID 1533647:    (UNCAUGHT_EXCEPT)
>>>     In function "main(int, char **)" an exception of type "std::runtime_error" is thrown and never caught.
481     int main(int argc, char** argv)
482     {
483         /*WARNING: PRIVILEGED CODE CHECKING START */
484     
485         /*WARNING*/ // early check for avoiding the security check for username 'cool'
486         /*WARNING*/ // (deliberately only this, not moving the entire parameter parsing here)

** CID 1533646:  Control flow issues  (DEADCODE)
/usr/include/Poco/NumericString.h: 137 in Poco::safeMultiply<unsigned long, unsigned long, short>(T1 &, T2, T3)()


________________________________________________________________________________________________________
*** CID 1533646:  Control flow issues  (DEADCODE)
/usr/include/Poco/NumericString.h: 137 in Poco::safeMultiply<unsigned long, unsigned long, short>(T1 &, T2, T3)()
131     			if (s < (std::numeric_limits<R>::min() / f))
132     				return false;
133     		}
134     	}
135     	else
136     	{
>>>     CID 1533646:  Control flow issues  (DEADCODE)
>>>     Execution cannot reach this statement: "if (s > 0) {
  if (f < 0UL ...".
137     		if (s > 0)
138     		{
139     			if (f < (std::numeric_limits<R>::min() / s))
140     				return false;
141     		}
142     		else

** CID 1533645:    (UNCAUGHT_EXCEPT)
/kit/ForKit.cpp: 481 in main()
/kit/ForKit.cpp: 481 in main()
/kit/ForKit.cpp: 481 in main()


________________________________________________________________________________________________________
*** CID 1533645:    (UNCAUGHT_EXCEPT)
/kit/ForKit.cpp: 481 in main()
475         std::cout << "  Single-threaded process that spawns lok instances" << std::endl;
476         std::cout << "  Note: Running this standalone is not possible. It is spawned by coolwsd" << std::endl;
477         std::cout << "        and is controlled via a pipe." << std::endl;
478         std::cout << "" << std::endl;
479     }
480     
>>>     CID 1533645:    (UNCAUGHT_EXCEPT)
>>>     In function "main(int, char **)" an exception of type "Poco::NullPointerException" is thrown and never caught.
481     int main(int argc, char** argv)
482     {
483         /*WARNING: PRIVILEGED CODE CHECKING START */
484     
485         /*WARNING*/ // early check for avoiding the security check for username 'cool'
486         /*WARNING*/ // (deliberately only this, not moving the entire parameter parsing here)
/kit/ForKit.cpp: 481 in main()
475         std::cout << "  Single-threaded process that spawns lok instances" << std::endl;
476         std::cout << "  Note: Running this standalone is not possible. It is spawned by coolwsd" << std::endl;
477         std::cout << "        and is controlled via a pipe." << std::endl;
478         std::cout << "" << std::endl;
479     }
480     
>>>     CID 1533645:    (UNCAUGHT_EXCEPT)
>>>     In function "main(int, char **)" an exception of type "Poco::NullPointerException" is thrown and never caught.
481     int main(int argc, char** argv)
482     {
483         /*WARNING: PRIVILEGED CODE CHECKING START */
484     
485         /*WARNING*/ // early check for avoiding the security check for username 'cool'
486         /*WARNING*/ // (deliberately only this, not moving the entire parameter parsing here)
/kit/ForKit.cpp: 481 in main()
475         std::cout << "  Single-threaded process that spawns lok instances" << std::endl;
476         std::cout << "  Note: Running this standalone is not possible. It is spawned by coolwsd" << std::endl;
477         std::cout << "        and is controlled via a pipe." << std::endl;
478         std::cout << "" << std::endl;
479     }
480     
>>>     CID 1533645:    (UNCAUGHT_EXCEPT)
>>>     In function "main(int, char **)" an exception of type "Poco::NullPointerException" is thrown and never caught.
481     int main(int argc, char** argv)
482     {
483         /*WARNING: PRIVILEGED CODE CHECKING START */
484     
485         /*WARNING*/ // early check for avoiding the security check for username 'cool'
486         /*WARNING*/ // (deliberately only this, not moving the entire parameter parsing here)

** CID 1533644:  Performance inefficiencies  (COPY_INSTEAD_OF_MOVE)
/net/Socket.cpp: 700 in SocketDisposition::execute()()


________________________________________________________________________________________________________
*** CID 1533644:  Performance inefficiencies  (COPY_INSTEAD_OF_MOVE)
/net/Socket.cpp: 700 in SocketDisposition::execute()()
694                 assert (isTransfer());
695                 // Ensure the thread is running before adding callback.
696                 _toPoll->startThread();
697                 auto pollCopy = _toPoll;
698                 auto socket = _socket;
699                 auto socketMoveFn = std::move(_socketMove);
>>>     CID 1533644:  Performance inefficiencies  (COPY_INSTEAD_OF_MOVE)
>>>     "socketMoveFn" is copied in call to copy constructor "std::function<void (std::shared_ptr<Socket> const &)>", when it could be moved instead.
700                 _toPoll->addCallback([pollCopy, socket, socketMoveFn]()
701                     {
702                         pollCopy->insertNewSocket(socket);
703                         socketMoveFn(socket);
704                     });
705             }

** CID 1533643:  Memory - corruptions  (USE_AFTER_FREE)
/net/clientnb.cpp: 269 in Client::main(const std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>> &)()


________________________________________________________________________________________________________
*** CID 1533643:  Memory - corruptions  (USE_AFTER_FREE)
/net/clientnb.cpp: 269 in Client::main(const std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>> &)()
263                 // Just accept the certificate anyway for testing purposes
264                 Poco::SharedPtr<Poco::Net::InvalidCertificateHandler> invalidCertHandler = new Poco::Net::AcceptCertificateHandler(false);
265     
266                 Poco::Net::Context::Params sslParams;
267                 Poco::Net::Context::Ptr sslContext = new Poco::Net::Context(Poco::Net::Context::CLIENT_USE, sslParams);
268                 Poco::Net::SSLManager::instance().initializeClient(nullptr, invalidCertHandler, sslContext);
>>>     CID 1533643:  Memory - corruptions  (USE_AFTER_FREE)
>>>     Calling "~SharedPtr" frees pointer "invalidCertHandler._ptr" which has already been freed.
269             }
270     
271             testWebsocketPingPong();
272             testWebsocketEcho();
273     
274             testPing();

** CID 1533642:    (NEGATIVE_RETURNS)
/wsd/FileServer.cpp: 465 in handleWopiRequest(const Poco::Net::HTTPRequest &, const RequestDetails &, Poco::MemoryInputStream &, const std::shared_ptr<StreamSocket> &)()
/wsd/FileServer.cpp: 420 in handleWopiRequest(const Poco::Net::HTTPRequest &, const RequestDetails &, Poco::MemoryInputStream &, const std::shared_ptr<StreamSocket> &)()
/wsd/FileServer.cpp: 448 in handleWopiRequest(const Poco::Net::HTTPRequest &, const RequestDetails &, Poco::MemoryInputStream &, const std::shared_ptr<StreamSocket> &)()


________________________________________________________________________________________________________
*** CID 1533642:    (NEGATIVE_RETURNS)
/wsd/FileServer.cpp: 465 in handleWopiRequest(const Poco::Net::HTTPRequest &, const RequestDetails &, Poco::MemoryInputStream &, const std::shared_ptr<StreamSocket> &)()
459                     }
460                 }
461     
462                 std::streamsize size = request.getContentLength();
463                 std::vector<char> buffer(size);
464                 message.read(buffer.data(), size);
>>>     CID 1533642:    (NEGATIVE_RETURNS)
>>>     "i" is passed to a parameter that cannot be negative. [Note: The source code implementation of the function has been overridden by a builtin model.]
465                 LocalFileInfo::fileInfoVec[i].fileLastModifiedTime = std::chrono::system_clock::now();
466     
467                 std::ofstream outfile;
468                 outfile.open(LocalFileInfo::fileInfoVec[i].localPath, std::ofstream::binary);
469                 outfile.write(buffer.data(), size);
470                 outfile.close();
/wsd/FileServer.cpp: 420 in handleWopiRequest(const Poco::Net::HTTPRequest &, const RequestDetails &, Poco::MemoryInputStream &, const std::shared_ptr<StreamSocket> &)()
414     
415                 socket->send(oss.str());
416                 return;
417             }
418             else if(request.getMethod() == "GET" && Util::endsWith(path.toString(), suffix))
419             {
>>>     CID 1533642:    (NEGATIVE_RETURNS)
>>>     "LocalFileInfo::getIndex(std::string(localPath))" is passed to a parameter that cannot be negative. [Note: The source code implementation of the function has been overridden by a builtin model.]
420                 LocalFileInfo localFile = LocalFileInfo::fileInfoVec[LocalFileInfo::getIndex(localPath)];
421                 auto ss = std::ostringstream{};
422                 std::ifstream inputFile(localFile.localPath);
423                 ss << inputFile.rdbuf();
424                 const std::string content = ss.str();
425                 const std::string mimeType = "text/plain; charset=utf-8";
/wsd/FileServer.cpp: 448 in handleWopiRequest(const Poco::Net::HTTPRequest &, const RequestDetails &, Poco::MemoryInputStream &, const std::shared_ptr<StreamSocket> &)()
442                 if (wopiTimestamp.empty())
443                 {
444                     wopiTimestamp = request.get("X-LOOL-WOPI-Timestamp", std::string());
445                 }
446                 if (!wopiTimestamp.empty())
447                 {
>>>     CID 1533642:    (NEGATIVE_RETURNS)
>>>     "i" is passed to a parameter that cannot be negative. [Note: The source code implementation of the function has been overridden by a builtin model.]
448                     const std::string fileModifiedTime = Util::getIso8601FracformatTime(LocalFileInfo::fileInfoVec[i].fileLastModifiedTime);
449                     if (wopiTimestamp != fileModifiedTime)
450                     {
451                         http::Response httpResponse(http::StatusCode::Conflict);
452                         httpResponse.setBody(
453                             "{\"COOLStatusCode\":" +

** CID 1533641:  Error handling issues  (NEGATIVE_RETURNS)
/net/Socket.cpp: 595 in SocketPoll::insertNewUnixSocket(const std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> &, const std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> &, const std::shared_ptr<WebSocketHandler> &, int)()


________________________________________________________________________________________________________
*** CID 1533641:  Error handling issues  (NEGATIVE_RETURNS)
/net/Socket.cpp: 595 in SocketPoll::insertNewUnixSocket(const std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> &, const std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> &, const std::shared_ptr<WebSocketHandler> &, int)()
589         addrunix.sun_path[0] = '\0'; // abstract name
590     #else
591         addrunix.sun_path[0] = '0';
592     #endif
593         memcpy(&addrunix.sun_path[1], location.c_str(), location.length());
594     
>>>     CID 1533641:  Error handling issues  (NEGATIVE_RETURNS)
>>>     "fd" is passed to a parameter that cannot be negative.
595         const int res = connect(fd, (const struct sockaddr*)&addrunix, sizeof(addrunix));
596         if (fd < 0 || (res < 0 && errno != EINPROGRESS))
597         {
598             LOG_SYS("Failed to connect to unix socket at " << location);
599             ::close(fd);
600             return false;

** CID 1533640:    (UNCAUGHT_EXCEPT)
/tools/Stress.cpp: 64 in Stress::main(const std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>> &)()
/tools/Stress.cpp: 64 in Stress::main(const std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>> &)()
/tools/Stress.cpp: 64 in Stress::main(const std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>> &)()
/tools/Stress.cpp: 64 in Stress::main(const std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>> &)()


________________________________________________________________________________________________________
*** CID 1533640:    (UNCAUGHT_EXCEPT)
/tools/Stress.cpp: 64 in Stress::main(const std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>> &)()
58     {
59         std::cerr << "Usage: coolstress wss://localhost:9980 <test-document-path> <trace-path> " << std::endl;
60         std::cerr << "       Trace files may be plain text or gzipped (with .gz extension)." << std::endl;
61         std::cerr << "       --help for full arguments list." << std::endl;
62     }
63     
>>>     CID 1533640:    (UNCAUGHT_EXCEPT)
>>>     In function "Stress::main(std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > const &)" an exception of type "std::runtime_error" is thrown and never caught.
64     int Stress::main(const std::vector<std::string>& args)
65     {
66         if (args.empty())
67         {
68             printHelp();
69             return EX_NOINPUT;
/tools/Stress.cpp: 64 in Stress::main(const std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>> &)()
58     {
59         std::cerr << "Usage: coolstress wss://localhost:9980 <test-document-path> <trace-path> " << std::endl;
60         std::cerr << "       Trace files may be plain text or gzipped (with .gz extension)." << std::endl;
61         std::cerr << "       --help for full arguments list." << std::endl;
62     }
63     
>>>     CID 1533640:    (UNCAUGHT_EXCEPT)
>>>     In function "Stress::main(std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > const &)" an exception of type "std::runtime_error" is thrown and never caught.
64     int Stress::main(const std::vector<std::string>& args)
65     {
66         if (args.empty())
67         {
68             printHelp();
69             return EX_NOINPUT;
/tools/Stress.cpp: 64 in Stress::main(const std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>> &)()
58     {
59         std::cerr << "Usage: coolstress wss://localhost:9980 <test-document-path> <trace-path> " << std::endl;
60         std::cerr << "       Trace files may be plain text or gzipped (with .gz extension)." << std::endl;
61         std::cerr << "       --help for full arguments list." << std::endl;
62     }
63     
>>>     CID 1533640:    (UNCAUGHT_EXCEPT)
>>>     In function "Stress::main(std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > const &)" an exception of type "std::runtime_error" is thrown and never caught.
64     int Stress::main(const std::vector<std::string>& args)
65     {
66         if (args.empty())
67         {
68             printHelp();
69             return EX_NOINPUT;
/tools/Stress.cpp: 64 in Stress::main(const std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>> &)()
58     {
59         std::cerr << "Usage: coolstress wss://localhost:9980 <test-document-path> <trace-path> " << std::endl;
60         std::cerr << "       Trace files may be plain text or gzipped (with .gz extension)." << std::endl;
61         std::cerr << "       --help for full arguments list." << std::endl;
62     }
63     
>>>     CID 1533640:    (UNCAUGHT_EXCEPT)
>>>     In function "Stress::main(std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > const &)" an exception of type "std::runtime_error" is thrown and never caught.
64     int Stress::main(const std::vector<std::string>& args)
65     {
66         if (args.empty())
67         {
68             printHelp();
69             return EX_NOINPUT;

** CID 1533639:  Error handling issues  (CHECKED_RETURN)
/common/FileUtil.hpp: 161 in FileUtil::Stat::Stat(const std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> &, bool)()


________________________________________________________________________________________________________
*** CID 1533639:  Error handling issues  (CHECKED_RETURN)
/common/FileUtil.hpp: 161 in FileUtil::Stat::Stat(const std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> &, bool)()
155         {
156             int clearStat() { memset (&_sb, 0, sizeof(_sb)); return 0; }
157         public:
158             /// Stat the given path. Symbolic links are stat'ed when @link is true.
159             Stat(const std::string& file, bool link = false)
160                 : _path(file)
>>>     CID 1533639:  Error handling issues  (CHECKED_RETURN)
>>>     Calling "lstat(file->c_str(), &this->_sb)" without checking return value. This library function may fail and return an error code.
161                 , _res(clearStat() | (link ? lstat(file.c_str(), &_sb) : stat(file.c_str(), &_sb)))
162                 , _errno(errno)
163             {
164             }
165     
166             bool good() const { return _res == 0; }

** CID 1533638:  Error handling issues  (UNCAUGHT_EXCEPT)
/wsd/COOLWSD.cpp: 6020 in COOLWSD::main(const std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>> &)()


________________________________________________________________________________________________________
*** CID 1533638:  Error handling issues  (UNCAUGHT_EXCEPT)
/wsd/COOLWSD.cpp: 6020 in COOLWSD::main(const std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>> &)()
6014         catch (const std::exception& ex)
6015         {
6016             LOG_ERR("Failed to uninitialize: " << ex.what());
6017         }
6018     }
6019     
>>>     CID 1533638:  Error handling issues  (UNCAUGHT_EXCEPT)
>>>     In function "COOLWSD::main(std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > const &)" an exception of type "ParseError" is thrown and never caught.
6020     int COOLWSD::main(const std::vector<std::string>& /*args*/)
6021     {
6022     #if MOBILEAPP && !defined IOS
6023         SigUtil::resetTerminationFlags();
6024     #endif
6025     

** CID 1533637:  Error handling issues  (CHECKED_RETURN)
/net/HttpHelper.cpp: 80 in HttpHelper::sendDeflatedFileContent(const std::shared_ptr<StreamSocket> &, const std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> &, int)()


________________________________________________________________________________________________________
*** CID 1533637:  Error handling issues  (CHECKED_RETURN)
/net/HttpHelper.cpp: 80 in HttpHelper::sendDeflatedFileContent(const std::shared_ptr<StreamSocket> &, const std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> &, int)()
74             file.read(&buf[0], fileSize);
75     
76             static const unsigned int Level = 1;
77             const long unsigned int size = file.gcount();
78             long unsigned int compSize = compressBound(size);
79             std::unique_ptr<char[]> cbuf(new char[compSize]);
>>>     CID 1533637:  Error handling issues  (CHECKED_RETURN)
>>>     Calling "compress2((Bytef *)cbuf[0UL], &compSize, (Bytef *)buf[0UL], size, 1)" without checking return value. This library function may fail and return an error code.
80             compress2((Bytef*)&cbuf[0], &compSize, (Bytef*)&buf[0], size, Level);
81     
82             if (size > 0)
83                 socket->send(&cbuf[0], compSize, true);
84         }
85     }

** CID 1533636:  Uninitialized members  (UNINIT_CTOR)
/tools/map.cpp: 122 in Map::Map()()


________________________________________________________________________________________________________
*** CID 1533636:  Uninitialized members  (UNINIT_CTOR)
/tools/map.cpp: 122 in Map::Map()()
116         return fd;
117     }
118     
119     struct Map {
120     private:
121         addr_t _start;
>>>     CID 1533636:  Uninitialized members  (UNINIT_CTOR)
>>>     The compiler-generated constructor for this class does not initialize "_end".
122         addr_t _end;
123         std::string _name;
124     public:
125         void setStart(addr_t start) { _start = start; }
126         addr_t getStart() const { return _start; }
127     


________________________________________________________________________________________________________
To view the defects in Coverity Scan visit, https://u15810271.ct.sendgrid.net/ls/click?upn=HRESupC-2F2Czv4BOaCWWCy7my0P0qcxCbhZ31OYv50ypSs1kiFPuCn2xFdlMIFBirii0zZ9j2-2F9F2XPBcBm2BNgi9duPy3v-2FzgFDd2LJ-2BDKI-3DaN9p_OTq2XUZbbipYjyLSo6GRo-2FpVxQ9OzkDINu9UTS-2FQhSdO0F0jQniitrGlNxDIzPJif0ifsrsNRORa-2Be4iP97QvnSQzd-2FHSSzx4lSgZ9s3fcryrzzcmYj0Nt-2FVToFDFcelajsh6qkYfFjkMLN7RV1JrrhX7PgYEbrMI3kVuyoeLVHCv84TBgn5lksF7BuTMDm5kp8fNrWy2KKzn9vQD6k-2FJiLfK3GhojieWSwbNTLygBY-3D




[Index of Archives]     [LARTC]     [Bugtraq]     [Yosemite Forum]     [Photo]

  Powered by Linux