Commit 67e0f41
authored
[dfsan] Make sprintf interceptor compatible with glibc 2.37+ and musl (llvm#78363)
snprintf interceptors call `format_buffer` with `size==~0ul`, which
may eventually lead to `snprintf(s, n, "Hello world!")` where `s+n`
wraps around. Since glibc 2.37 (https://sourceware.org/PR30441), the
snprintf call does not write the last char. musl snprintf returns -1
with EOVERFLOW when `n > INT_MAX`.
Change `size` to INT_MAX to work with glibc 2.37+ and musl.
snprintf interceptors are not changed. It's user responsibility to not
cause a compatibility issue with libc implementations.
Fix llvm#606781 parent 430a40d commit 67e0f41
File tree
3 files changed
+3
-9
lines changed- compiler-rt
- lib/dfsan
- test/dfsan
3 files changed
+3
-9
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2792 | 2792 | | |
2793 | 2793 | | |
2794 | 2794 | | |
2795 | | - | |
| 2795 | + | |
2796 | 2796 | | |
2797 | 2797 | | |
2798 | 2798 | | |
| |||
2806 | 2806 | | |
2807 | 2807 | | |
2808 | 2808 | | |
2809 | | - | |
2810 | | - | |
| 2809 | + | |
| 2810 | + | |
2811 | 2811 | | |
2812 | 2812 | | |
2813 | 2813 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
2 | | - | |
3 | | - | |
4 | 1 | | |
5 | 2 | | |
6 | 3 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
2 | | - | |
3 | | - | |
4 | 1 | | |
5 | 2 | | |
6 | 3 | | |
| |||
0 commit comments