From 58561706ca99e043a4687a776dc781bdf7e78e07 Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=A9mie=20Galarneau?= Date: Thu, 8 Jun 2023 13:42:50 -0400 Subject: [PATCH] Fix: container-wrapper: size container operation can throw MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit 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 --- src/common/container-wrapper.hpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) 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); } -- 2.34.1