Skip to content

Commit 23596fe

Browse files
committed
sanitizer_common: don't write into .rodata
setlocale interceptor imitates a write into result, which may be located in .rodata section. This is the only interceptor that tries to do this and I think the intention was to initialize the range for msan. So do that instead. Writing into .rodata shouldn't happen (without crashing later on the actual write) and this traps on my local tsan experiments. Reviewed By: vitalybuka Differential Revision: https://reviews.llvm.org/D102161
1 parent 85a96d8 commit 23596fe

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

compiler-rt/lib/sanitizer_common/sanitizer_common_interceptors.inc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3357,7 +3357,7 @@ INTERCEPTOR(char *, setlocale, int category, char *locale) {
33573357
COMMON_INTERCEPTOR_READ_RANGE(ctx, locale, REAL(strlen)(locale) + 1);
33583358
char *res = REAL(setlocale)(category, locale);
33593359
if (res) {
3360-
COMMON_INTERCEPTOR_WRITE_RANGE(ctx, res, REAL(strlen)(res) + 1);
3360+
COMMON_INTERCEPTOR_INITIALIZE_RANGE(res, REAL(strlen)(res) + 1);
33613361
unpoison_ctype_arrays(ctx);
33623362
}
33633363
return res;

0 commit comments

Comments
 (0)