Fix: logging: unhandled error in *_FMT macros
authorJérémie Galarneau <jeremie.galarneau@efficios.com>
Thu, 13 Apr 2023 18:31:33 +0000 (14:31 -0400)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Tue, 18 Apr 2023 14:36:50 +0000 (10:36 -0400)
commit003f455dab0204dd3f066ecdbea0470035f8181f
treec9d18b14f3e60b4025757e8f3e2b34e97841d4db
parent1944cedb180887d9dfe0906f930df167e714af99
Fix: logging: unhandled error in *_FMT macros

Coverity reports:

1508779 Uncaught exception
If the exception is ever thrown, the program will crash.

In lttng::​sessiond::​rotation_thread::​_thread_function(): A C++ exception
is thrown but never caught (CWE-248)

The *_FMT macros, which use fmtlib, don't handle the case where
fmt::format throws. This can happen, in particular, when an invalid
format string is used.

The macros are modified to log the exception and abort.

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: I7f4a066b418a9d544a679f773df7e94640755f47
src/common/error.cpp
src/common/error.hpp
This page took 0.027078 seconds and 4 git commands to generate.