[compiler-rt] [ASan][Windows] Fix memmove/memcpy interception on x64 (PR #192060)

Alexandre Ganea via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 16 05:45:29 PDT 2026


================
@@ -803,11 +803,12 @@ struct Allocator {
       u8 chunk_state = atomic_load(&m->chunk_state, memory_order_acquire);
       if (chunk_state != CHUNK_ALLOCATED)
         ReportInvalidFree(old_ptr, chunk_state, stack);
-      CHECK_NE(REAL(memcpy), nullptr);
       uptr memcpy_size = Min(new_size, m->UsedSize());
       // If realloc() races with free(), we may start copying freed memory.
       // However, we will report racy double-free later anyway.
-      REAL(memcpy)(new_ptr, old_ptr, memcpy_size);
+      // Avoid intercepted CRT memcpy/memmove (see
+      // sanitizer_allocator_combined.h)
+      internal_memcpy(new_ptr, old_ptr, memcpy_size);
----------------
aganea wrote:

Changed so that this only applies to WIN64 and only for this specific CRT version (when memmove != memcpy).

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


More information about the llvm-commits mailing list