Fix: coverity warns of uncaught exception
authorJérémie Galarneau <jeremie.galarneau@efficios.com>
Wed, 7 Jun 2023 20:28:27 +0000 (16:28 -0400)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Wed, 7 Jun 2023 21:03:43 +0000 (17:03 -0400)
commitfeef6f74e701ea68540ca306628888c1cf4f01bd
treefffd5679114b32b508eb2d705c39c6d5624abe57
parent56e5528de1689e0cc07c115f41f0cc3d9c7ce8d3
Fix: coverity warns of uncaught exception

Coverity warns that some container operations used by
random_access_container_wrapper can throw even though methods are marked
as noexcept.

  CID 1512893 (#1-2 of 2): Uncaught exception (UNCAUGHT_EXCEPT)
  exn_spec_violation: An exception of type lttng::invalid_argument_error is thrown but the exception specification noexcept doesn't allow it to be thrown. This will result in a call to terminate().

The noexcept specifier is remvoved from operator* and end() of
random_access_container_wrapper's iterator implementation.

To make this a bit clearer, a bounds check is performed in operator[]
directly which will make errors easier to catch.

Reported-by: Coverity Scan
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: I31d51e8709d33b3c80d64c8c05a23e519e3a93e7
src/common/container-wrapper.hpp
This page took 0.026081 seconds and 4 git commands to generate.