include/o3tl/safeint.hxx | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-)
New commits: commit 65b99967c4da8e57ebabc9bed98818750fc82038 Author: Caolán McNamara <[email protected]> AuthorDate: Fri Mar 26 16:40:27 2021 +0000 Commit: Caolán McNamara <[email protected]> CommitDate: Fri Mar 26 20:41:12 2021 +0100 split this to give a sanitizing return pass through Change-Id: I81eba14e31fe12fc92403c15e5d46f0493022f50 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/113169 Tested-by: Jenkins Reviewed-by: Caolán McNamara <[email protected]> diff --git a/include/o3tl/safeint.hxx b/include/o3tl/safeint.hxx index c2610edacec6..522eb166912b 100644 --- a/include/o3tl/safeint.hxx +++ b/include/o3tl/safeint.hxx @@ -239,11 +239,17 @@ make_unsigned(T value) // tools like -fsanitize=implicit-conversion should still be able to detect truncation: template<typename T1, typename T2> constexpr T1 narrowing(T2 value) { return value; } -// std::min wrapped to inform coverity that the result is now deemed sanitized +// inform coverity that the returned value is now deemed sanitized // coverity[ -taint_source ] -template<typename T> inline T sanitizing_min(T a, T b) +template<typename T> [[nodiscard]] inline T deem_sanitized(T a) +{ + return a; +} + +// std::min wrapped to inform coverity that the result is now deemed sanitized +template<typename T> [[nodiscard]] inline T sanitizing_min(T a, T b) { - return std::min(a, b); + return o3tl::deem_sanitized(std::min(a, b)); } } _______________________________________________ Libreoffice-commits mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
