[compiler-rt] [compiler-rt][asan] Add wcscpy/wcsncpy; enable wcscat/wcsncat on Windows (PR #160493)

Devon Loehr via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 1 10:06:24 PDT 2025


DKLoehr wrote:

We're seeing the newly-added tests fail when building for mac. Chromium issue: https://g-issues.chromium.org/issues/448631142

Relevant output:

```
Failed Tests (4):
   AddressSanitizer-x86_64-darwin :: TestCases/wcscat.cpp
   AddressSanitizer-x86_64-darwin :: TestCases/wcscpy.cpp
   AddressSanitizer-x86_64-darwin :: TestCases/wcsncat.cpp
   AddressSanitizer-x86_64-darwin :: TestCases/wcsncpy.cpp
```

Snippet of one of the failures
```
/Volumes/Work/s/w/ir/cache/builder/src/third_party/llvm/compiler-rt/test/asan/TestCases/wcsncpy.cpp:23:12: error: CHECK: expected string not found in input
  // CHECK: #0 [[ADDR:0x[0-9a-f]+]] in wcsncpy{{.*}}asan_interceptors.cpp:{{[0-9]+}}
            ^
 <stdin>:4:45: note: scanning from here
 WRITE of size 60 at 0x7ff7bc7f6e2c thread T0
                                             ^
 <stdin>:10:7: note: possible intended match here
  #0 0x000103708a6f in main wcsncpy.cpp:9
  
...

Input was:
 <<<<<<
             1: Good so far. 
             2: ================================================================= 
             3: ==63539==ERROR: AddressSanitizer: stack-buffer-overflow on address 0x7ff7bc7f6e2c at pc 0x00010396a241 bp 0x7ff7bc7f6d90 sp 0x7ff7bc7f6540 
             4: WRITE of size 60 at 0x7ff7bc7f6e2c thread T0 
 check:23'0                                                 X error: no match found
             5:  #0 0x00010396a240 in wcsncpy+0x4e0 (libclang_rt.asan_osx_dynamic.dylib:x86_64+0x50240) 
 check:23'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
             6:  #1 0x000103708bd8 in main wcsncpy.cpp:20 
```

It seems like it might be missing the `asan_interceptors` suffix on line `5:`.

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


More information about the llvm-commits mailing list