Commit 6dfd5d9
authored
Disable word-at-a-time optimization in mbsrtowcs when using ASan (#26678)
This optimization can cause ASan to report global-buffer-overflow
because it reads up to 3 bytes past the end of the input string when
checking for null terminators or non-ASCII characters.
We already do this for several other musl functions such as strlen,
stpcpy, and memchr.
Also updates test_asan_no_error.c to include a regression check.
Fixes: #266571 parent e42e640 commit 6dfd5d9
File tree
2 files changed
+12
-2
lines changed- system/lib/libc/musl/src/multibyte
- test/core
2 files changed
+12
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
38 | 38 | | |
39 | 39 | | |
40 | 40 | | |
41 | | - | |
| 41 | + | |
| 42 | + | |
42 | 43 | | |
43 | 44 | | |
44 | 45 | | |
| |||
72 | 73 | | |
73 | 74 | | |
74 | 75 | | |
75 | | - | |
| 76 | + | |
| 77 | + | |
76 | 78 | | |
77 | 79 | | |
78 | 80 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
| 4 | + | |
| 5 | + | |
4 | 6 | | |
5 | 7 | | |
6 | 8 | | |
| |||
17 | 19 | | |
18 | 20 | | |
19 | 21 | | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
20 | 28 | | |
21 | 29 | | |
22 | 30 | | |
| |||
0 commit comments