aboutsummaryrefslogtreecommitdiffstats
path: root/tests/fortify1_test_clang.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Reorganize FORTIFY_SOURCE tests.Nick Kralevich2013-06-281-379/+0
| | | | | | | | | Get rid of a lot of the duplication in the various FORTIFY_SOURCE tests. Instead, we build 4 separate static libraries, with 4 different compile time options, and link them into the final test binary. Change-Id: Idb0b7cccc8dd837adb037bf4ddfe8942ae138230
* stdio.h: enable vs?printf clang FORTIFY_SOURCENick Kralevich2013-06-271-0/+44
| | | | | | | | | | | | Enable FORTIFY_SOURCE protections under clang for the following functions: * vsprintf * vsnprintf and add unittests. Change-Id: I90f8a27f7b202c78b5dd8ebf53050bf9e33496f7
* libc: enable FORTIFY_SOURCE snprintf under clangNick Kralevich2013-06-251-0/+9
| | | | Change-Id: I8b8059782a720104722b0841994b38f873ed02aa
* libc: enable sprintf FORTIFY_SOURCE under clangNick Kralevich2013-06-241-0/+14
| | | | | | | clang doesn't support __builtin_va_arg_pack(), so we have to use #define instead. Change-Id: I2ee75e6267d60cdf997fee6b9b0547bf68f062a1
* libc: enable FORTIFY_SOURCE clang strlcpyNick Kralevich2013-06-201-0/+10
| | | | Change-Id: Idcfe08f5afc3dde592416df9eba83f64e130c7c2
* Fix FORTIFY_SOURCE unittests.Nick Kralevich2013-06-191-2/+6
| | | | | | The compiler is too damn smart. Change-Id: Ibef3ef41ec99f8cd9c06f1dbca535819f9a08197
* libc: add limited FORTIFY_SOURCE support for clangNick Kralevich2013-06-181-0/+298
In 829c089f83ddee37203b52bcb294867a9ae7bdbc, we disabled all FORTIFY_SOURCE support when compiling under clang. At the time, we didn't have proper test cases, and couldn't easily create targeted clang tests. This change re-enables FORTIFY_SOURCE support under clang for a limited set of functions, where we have explicit unittests available. The functions are: * memcpy * memmove * strcpy * strncpy * strcat * strncat * memset * strlen (with modifications) * strchr (with modifications) * strrchr (with modifications) It may be possible, in the future, to enable other functions. However, I need to write unittests first. For strlen, strchr, and strrchr, clang unconditionally calls the fortified version of the relevant function. If it doesn't know the size of the buffer it's dealing with, it passes in ((size_t) -1), which is the largest possible size_t. I added two new clang specific unittest files, primarily copied from fortify?_test.cpp. I've also rebuild the entire system with these changes, and didn't observe any obvious problems. Change-Id: If12a15089bb0ffe93824b485290d05b14355fcaa