Fix: container-wrapper: size container operation can throw
authorJérémie Galarneau <jeremie.galarneau@efficios.com>
Thu, 8 Jun 2023 17:42:50 +0000 (13:42 -0400)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Thu, 8 Jun 2023 17:42:50 +0000 (13:42 -0400)
  1512923 Uncaught exception
  If the exception is ever thrown, the program will crash.

  In lttng::​utils::​random_access_container_wrapper<lttng_action const *, lttng_action const *, lttng::​ctl::​details::​const_action_list_operations>::​size(): A C++ exception is thrown but never caught (CWE-248)

Reported-by: Coverity Scan
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: I5f8bffc64fb239e59b272985f6b3c959d238da0a

src/common/container-wrapper.hpp

index 5ee20dfeab3b2b3f92d94539ddf25dd156fae0e1..c2c59f89da06f07595d5c7cd262dfbc3fcbdde35 100644 (file)
@@ -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);
        }
This page took 0.034275 seconds and 4 git commands to generate.