diff options
author | Vitaly Buka <vitalybuka@google.com> | 2025-01-06 19:17:09 +0100 |
---|---|---|
committer | Stefan Schulze Frielinghaus <stefansf@gcc.gnu.org> | 2025-01-06 19:17:09 +0100 |
commit | f0b8256224ec082ecffddcb5624a4b5032c09113 (patch) | |
tree | 045b164068a39cc3c72cb99c0ac898716af720f3 | |
parent | 1bd03564f29dc31e67e67efd93137d50fa7bb8a4 (diff) | |
download | gcc-f0b8256224ec082ecffddcb5624a4b5032c09113.zip gcc-f0b8256224ec082ecffddcb5624a4b5032c09113.tar.gz gcc-f0b8256224ec082ecffddcb5624a4b5032c09113.tar.bz2 |
Fix few size types in memprof (#119114)
Fix type in a few related Min() calls.
Follow up to #116957.
Cherry picked from LLVM commit 6dec33834d1fd89f16e271dde9607c1de9554144
(removed memprof part).
libsanitizer/ChangeLog:
PR sanitizer/117725
* asan/asan_interceptors.cpp: Cherry picked from LLVM commit
6dec33834d1fd89f16e271dde9607c1de9554144.
* sanitizer_common/sanitizer_common_interceptors.inc: Ditto.
Co-authored-by: Stefan Schulze Frielinghaus <stefansf@linux.ibm.com>
-rw-r--r-- | libsanitizer/asan/asan_interceptors.cpp | 4 | ||||
-rw-r--r-- | libsanitizer/sanitizer_common/sanitizer_common_interceptors.inc | 2 |
2 files changed, 3 insertions, 3 deletions
diff --git a/libsanitizer/asan/asan_interceptors.cpp b/libsanitizer/asan/asan_interceptors.cpp index 48f7636..0239e0c 100644 --- a/libsanitizer/asan/asan_interceptors.cpp +++ b/libsanitizer/asan/asan_interceptors.cpp @@ -535,7 +535,7 @@ INTERCEPTOR(char*, strncat, char *to, const char *from, usize size) { AsanInitFromRtl(); if (flags()->replace_str) { uptr from_length = MaybeRealStrnlen(from, size); - uptr copy_length = Min(size, from_length + 1); + uptr copy_length = Min<uptr>(size, from_length + 1); ASAN_READ_RANGE(ctx, from, copy_length); uptr to_length = internal_strlen(to); ASAN_READ_STRING_OF_LEN(ctx, to, to_length, to_length); @@ -622,7 +622,7 @@ INTERCEPTOR(char*, strncpy, char *to, const char *from, usize size) { ASAN_INTERCEPTOR_ENTER(ctx, strncpy); AsanInitFromRtl(); if (flags()->replace_str) { - uptr from_size = Min(size, MaybeRealStrnlen(from, size) + 1); + uptr from_size = Min<uptr>(size, MaybeRealStrnlen(from, size) + 1); CHECK_RANGES_OVERLAP("strncpy", to, from_size, from, from_size); ASAN_READ_RANGE(ctx, from, from_size); ASAN_WRITE_RANGE(ctx, to, size); diff --git a/libsanitizer/sanitizer_common/sanitizer_common_interceptors.inc b/libsanitizer/sanitizer_common/sanitizer_common_interceptors.inc index 542176e..b0adcf1 100644 --- a/libsanitizer/sanitizer_common/sanitizer_common_interceptors.inc +++ b/libsanitizer/sanitizer_common/sanitizer_common_interceptors.inc @@ -347,7 +347,7 @@ extern const short *_tolower_tab_; uptr copy_length = internal_strnlen(s, size); \ char *new_mem = (char *)WRAP(malloc)(copy_length + 1); \ if (common_flags()->intercept_strndup) { \ - COMMON_INTERCEPTOR_READ_STRING(ctx, s, Min(size, copy_length + 1)); \ + COMMON_INTERCEPTOR_READ_STRING(ctx, s, Min<uptr>(size, copy_length + 1)); \ } \ if (new_mem) { \ COMMON_INTERCEPTOR_COPY_STRING(ctx, new_mem, s, copy_length); \ |