include/o3tl/safeint.hxx |   12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

New commits:
commit 65b99967c4da8e57ebabc9bed98818750fc82038
Author:     Caolán McNamara <caol...@redhat.com>
AuthorDate: Fri Mar 26 16:40:27 2021 +0000
Commit:     Caolán McNamara <caol...@redhat.com>
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 <caol...@redhat.com>

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
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to