diff options
author | Yixuan Cao <caoyixuan2019@email.szu.edu.cn> | 2025-10-01 03:13:29 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-09-30 12:13:29 -0700 |
commit | 6ca835b7f4349ad55c8e8afdf0669927b6b284b4 (patch) | |
tree | 384cfc5dca58b34f9f83036a2f42a3f4c66be21a /mlir/lib/Bindings/Python/MainModule.cpp | |
parent | 9d42c752569f3141ca42b75dd37f45e771ffa7a0 (diff) | |
download | llvm-6ca835b7f4349ad55c8e8afdf0669927b6b284b4.zip llvm-6ca835b7f4349ad55c8e8afdf0669927b6b284b4.tar.gz llvm-6ca835b7f4349ad55c8e8afdf0669927b6b284b4.tar.bz2 |
[compiler-rt][asan] Add wcscpy/wcsncpy; enable wcscat/wcsncat on Windows (#160493)
Summary
- Add ASan interceptors for wcscpy/wcsncpy on all platforms.
- Enable wcscat/wcsncat on Windows (already enabled on POSIX via
sanitizer_common).
Motivation
- Use of wchar string APIs is common on Windows; improve parity with
char* string checks.
Changes
- Implement wcscpy/wcsncpy in asan_interceptors.cpp; check overlap and
mark read/write ranges in bytes.
- wcsncpy: compute write size in bytes (size * sizeof(wchar_t)) to avoid
missed overflows when sizeof(wchar_t) != 1.
- Use MaybeRealWcsnlen when available to bound reads.
- Register Windows static thunk for wcscpy/wcsncpy/wcscat/wcsncat; rely
on sanitizer_common interceptors for wcscat/wcsncat.
- Tests: add wcscpy/wcsncpy/wcscat/wcsncat; flush stdout before crash;
use resilient FileCheck patterns (reuse [[ADDR]], wildcard for function
suffixes and paths, flexible line numbers).
Testing
- AArch64 Linux: new tests pass with check-asan locally.
Follow-up to and based on prior work in PR #90909 (author: branh,
Microsoft); builds on that work and addresses review feedback. Thanks!
---------
Signed-off-by: Yixuan Cao <caoyixuan2019@email.szu.edu.cn>
Diffstat (limited to 'mlir/lib/Bindings/Python/MainModule.cpp')
0 files changed, 0 insertions, 0 deletions