[PATCH] D22610: [compiler-rt] Fix memmove/memcpy overlap detection on windows

Etienne Bergeron via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 20 22:12:11 PDT 2016


etienneb created this revision.
etienneb added a reviewer: rnk.
etienneb added subscribers: chrisha, wang0109, llvm-commits.
Herald added a subscriber: kubabrecka.

The memcpy and memmove functions are the same on windows.
The overlap detection logic is incorrect.

printf-1 test:
``
stdin>:2:114: note: possible intended match here
==877412==ERROR: AddressSanitizer: memcpy-param-overlap: memory ranges [0x0000002bf2a8,0x0000002bf2ad) and [0x0000002bf2a9, 0x0000002bf2ae) overlap
```                                                                                                                 ^

https://reviews.llvm.org/D22610

Files:
  lib/asan/asan_interceptors.cc

Index: lib/asan/asan_interceptors.cc
===================================================================
--- lib/asan/asan_interceptors.cc
+++ lib/asan/asan_interceptors.cc
@@ -399,7 +399,7 @@
     }                                                                          \
     ENSURE_ASAN_INITED();                                                      \
     if (flags()->replace_intrin) {                                             \
-      if (to != from) {                                                        \
+      if (PLATFORM_HAS_DIFFERENT_MEMCPY_AND_MEMMOVE && to != from) {           \
         CHECK_RANGES_OVERLAP("memcpy", to, size, from, size);                  \
       }                                                                        \
       ASAN_READ_RANGE(ctx, from, size);                                        \


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D22610.64819.patch
Type: text/x-patch
Size: 849 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160721/332db95e/attachment.bin>


More information about the llvm-commits mailing list