[compiler-rt] [sanitizer] Fix type in some Min() calls (PR #119248)

via llvm-commits llvm-commits at lists.llvm.org
Mon Dec 9 11:02:40 PST 2024


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-compiler-rt-sanitizer

Author: Stefan Schulze Frielinghaus (stefan-sf-ibm)

<details>
<summary>Changes</summary>

This is a follow-up to 6dec33834d1fd89f16e271dde9607c1de9554144 and #<!-- -->116957 and #<!-- -->119114.

---
Full diff: https://github.com/llvm/llvm-project/pull/119248.diff


1 Files Affected:

- (modified) compiler-rt/lib/sanitizer_common/sanitizer_common_interceptors.inc (+6-6) 


``````````diff
diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_common_interceptors.inc b/compiler-rt/lib/sanitizer_common/sanitizer_common_interceptors.inc
index 47436a6cd20f0b..c724c9e826f40b 100644
--- a/compiler-rt/lib/sanitizer_common/sanitizer_common_interceptors.inc
+++ b/compiler-rt/lib/sanitizer_common/sanitizer_common_interceptors.inc
@@ -532,8 +532,8 @@ INTERCEPTOR(int, strncmp, const char *s1, const char *s2, usize size) {
     for (; i1 < size && s1[i1]; i1++) {}
     for (; i2 < size && s2[i2]; i2++) {}
   }
-  COMMON_INTERCEPTOR_READ_RANGE((ctx), (s1), Min(i1 + 1, size));
-  COMMON_INTERCEPTOR_READ_RANGE((ctx), (s2), Min(i2 + 1, size));
+  COMMON_INTERCEPTOR_READ_RANGE((ctx), (s1), Min<uptr>(i1 + 1, size));
+  COMMON_INTERCEPTOR_READ_RANGE((ctx), (s2), Min<uptr>(i2 + 1, size));
   int result = CharCmpX(c1, c2);
   CALL_WEAK_INTERCEPTOR_HOOK(__sanitizer_weak_hook_strncmp, GET_CALLER_PC(), s1,
                              s2, size, result);
@@ -595,8 +595,8 @@ INTERCEPTOR(int, strncasecmp, const char *s1, const char *s2, SIZE_T size) {
     for (; i1 < size && s1[i1]; i1++) {}
     for (; i2 < size && s2[i2]; i2++) {}
   }
-  COMMON_INTERCEPTOR_READ_RANGE((ctx), (s1), Min(i1 + 1, size));
-  COMMON_INTERCEPTOR_READ_RANGE((ctx), (s2), Min(i2 + 1, size));
+  COMMON_INTERCEPTOR_READ_RANGE((ctx), (s1), Min<uptr>(i1 + 1, size));
+  COMMON_INTERCEPTOR_READ_RANGE((ctx), (s2), Min<uptr>(i2 + 1, size));
   int result = CharCaseCmp(c1, c2);
   CALL_WEAK_INTERCEPTOR_HOOK(__sanitizer_weak_hook_strncasecmp, GET_CALLER_PC(),
                              s1, s2, size, result);
@@ -857,8 +857,8 @@ int MemcmpInterceptorCommon(void *ctx,
         c2 = s2[i];
         if (c1 != c2) break;
       }
-      COMMON_INTERCEPTOR_READ_RANGE(ctx, s1, Min(i + 1, size));
-      COMMON_INTERCEPTOR_READ_RANGE(ctx, s2, Min(i + 1, size));
+      COMMON_INTERCEPTOR_READ_RANGE(ctx, s1, Min<uptr>(i + 1, size));
+      COMMON_INTERCEPTOR_READ_RANGE(ctx, s2, Min<uptr>(i + 1, size));
       int r = CharCmpX(c1, c2);
       CALL_WEAK_INTERCEPTOR_HOOK(__sanitizer_weak_hook_memcmp, GET_CALLER_PC(),
                                  a1, a2, size, r);

``````````

</details>


https://github.com/llvm/llvm-project/pull/119248


More information about the llvm-commits mailing list