Displaying 2 results from an estimated 2 matches for "_chk".
Did you mean:
_ch
2019 Dec 03
5
clang and -D_FORTIFY_SOURCE=1
...requirements.rst
TL;DR: clang does provide a similar compile-time checking as gcc, but no runtime
checking. To assert that I wrote a small test suite:
https://github.com/serge-sans-paille/fortify-test-suite
And indeed, clang doesn't pass it, mostly because it turns call to
__builtin__(.*)_chk into calls to __builtin__\1.
We need to support the runtime behavior of the following builtins:
- __builtin___memcpy_chk
- __builtin___memmove_chk
- __builtin___mempcpy_chk
- __builtin___memset_chk
- __builtin___snprintf_chk
- __builtin___sprintf_chk
- __builtin___stpcpy_chk
- __builtin___strcat_...
2019 Dec 04
2
[cfe-dev] clang and -D_FORTIFY_SOURCE=1
> Are you sure you've diagnosed the issue correctly? __builtin___memcpy_chk
works correctly, as far as I know.
100% sure. Let's have a look at the output of
#include <string.h>
static char dest[10];
char* square(int n) {
memcpy(dest, "hello", n);
return dest;
}
compiled with -D_FORTIFY_SOURCE=1 -O1 : https://godbolt.org/z/UvABWp
Clan...