From: Jérémie Galarneau Date: Thu, 8 Jun 2023 17:42:50 +0000 (-0400) Subject: Fix: container-wrapper: size container operation can throw X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=58561706ca99e043a4687a776dc781bdf7e78e07;p=lttng-tools.git Fix: container-wrapper: size container operation can throw 1512923 Uncaught exception If the exception is ever thrown, the program will crash. In lttng::​utils::​random_access_container_wrapper::​size(): A C++ exception is thrown but never caught (CWE-248) Reported-by: Coverity Scan Signed-off-by: Jérémie Galarneau Change-Id: I5f8bffc64fb239e59b272985f6b3c959d238da0a --- diff --git a/src/common/container-wrapper.hpp b/src/common/container-wrapper.hpp index 5ee20dfea..c2c59f89d 100644 --- a/src/common/container-wrapper.hpp +++ b/src/common/container-wrapper.hpp @@ -99,7 +99,7 @@ public: iterator end() { - return iterator(*this, ContainerOperations::size(_container)); + return iterator(*this, size()); } const_iterator begin() const noexcept @@ -109,10 +109,10 @@ public: const_iterator end() const { - return const_iterator(*this, ContainerOperations::size(_container)); + return const_iterator(*this, size()); } - std::size_t size() const noexcept + std::size_t size() const { return ContainerOperations::size(_container); }