You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[compiler-rt][asan] Reland: wcscpy/wcsncpy interceptors and stabilize wchar tests on Darwin/Android
- Motivation
- Reintroduce wchar interceptors (wcscpy/wcsncpy) and broaden ASan coverage; improve Windows parity with narrow-string checks.
- Stabilize tests across Darwin/Android to keep bots green.
- Runtime
- Reintroduce wcscpy/wcsncpy interceptors (overlap checks; mark read/write ranges in bytes).
- Use MaybeRealWcsnlen when available to bound reads.
- Register Windows static runtime thunk where applicable.
- Tests
- Android: keep %env_asan_opts=log_to_stderr=1 so the ASan header is on stderr.
- Darwin: DAG group the potentially reordered lines.
- Risk
- Functional reland (runtime + tests), intended to restore functionality and keep bots green across platforms.
Signed-off-by: Yixuan Cao <[email protected]>
// CHECK-DAG: ERROR: AddressSanitizer: stack-buffer-overflow on address [[ADDR:0x[0-9a-f]+]] at pc {{0x[0-9a-f]+}} bp {{0x[0-9a-f]+}} sp {{0x[0-9a-f]+}}
23
+
// CHECK-DAG: WRITE of size {{[0-9]+}} at [[ADDR]] thread T0
// CHECK-DAG: ERROR: AddressSanitizer: stack-buffer-overflow on address [[ADDR:0x[0-9a-f]+]] at pc {{0x[0-9a-f]+}} bp {{0x[0-9a-f]+}} sp {{0x[0-9a-f]+}}
20
+
// CHECK-DAG: WRITE of size {{[0-9]+}} at [[ADDR]] thread T0
// CHECK-DAG: ERROR: AddressSanitizer: stack-buffer-overflow on address [[ADDR:0x[0-9a-f]+]] at pc {{0x[0-9a-f]+}} bp {{0x[0-9a-f]+}} sp {{0x[0-9a-f]+}}
24
+
// CHECK-DAG: WRITE of size {{[0-9]+}} at [[ADDR]] thread T0
wcsncpy(badDst, src, 7); // This should still work.
16
+
fprintf(stderr, "Good so far.\n");
17
+
// CHECK-DAG: Good so far.
18
+
fflush(stderr);
19
+
wcsncpy(badDst, src, 15); // Boom!
20
+
// CHECK-DAG: ERROR: AddressSanitizer: stack-buffer-overflow on address [[ADDR:0x[0-9a-f]+]] at pc {{0x[0-9a-f]+}} bp {{0x[0-9a-f]+}} sp {{0x[0-9a-f]+}}
21
+
// CHECK-DAG: WRITE of size {{[0-9]+}} at [[ADDR]] thread T0
0 commit comments