aboutsummaryrefslogtreecommitdiff
path: root/src/libutil/error.hh
diff options
context:
space:
mode:
authorJade Lovelace <lix@jade.fyi>2024-06-18 19:11:44 -0700
committerJade Lovelace <lix@jade.fyi>2024-06-18 19:26:54 -0700
commitf2fff1faa4c6a308ad30da691e18ceccf6626e0d (patch)
tree10e8149775d0268a5bdab0c45054e8027b9f1989 /src/libutil/error.hh
parente0a3a5f2267b28b242c5e2fbaca261b0bbd607c0 (diff)
libmain: fix UB in verbosity assignment
This was generating an out-of-range verbosity value. We should just process it as an int and then convert to verbosity with a clamping function, which trivially avoids any domain type violations. Change-Id: I0ed20da8e1496a1225ff3008b76827d99265d404
Diffstat (limited to 'src/libutil/error.hh')
-rw-r--r--src/libutil/error.hh2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/libutil/error.hh b/src/libutil/error.hh
index 0884f9f32..06dfba0df 100644
--- a/src/libutil/error.hh
+++ b/src/libutil/error.hh
@@ -45,6 +45,8 @@ typedef enum {
lvlVomit
} Verbosity;
+Verbosity verbosityFromIntClamped(int val);
+
/**
* The lines of code surrounding an error.
*/