.travis.yml: add a wrapped functions grepper script
This commit is contained in:
parent
fa4f1c5b0f
commit
7ef3fdec00
19
.travis.yml
19
.travis.yml
|
@ -45,3 +45,22 @@ script:
|
|||
- CFLAGS="-Wformat -Wformat-security -Wextra -Wno-unused-parameter -Werror" make -j
|
||||
- (cd testcases && xvfb-run ./complete-run.pl --parallel=1 || (cat latest/complete-run.log; false))
|
||||
- clang-format-3.5 -i $(find . -name "*.[ch]" | tr '\n' ' ') && git diff --exit-code || (echo 'Code was not formatted using clang-format!'; false)
|
||||
- |
|
||||
funcs='malloc|calloc|realloc|strdup|strndup|asprintf|write'
|
||||
cstring='"([^"\\]|\\.)*"'
|
||||
cchar="'[^\\\\]'|'\\\\.[^']*'"
|
||||
regex="^([^'\"]|${cstring}|${cchar})*\<(${funcs})\>"
|
||||
detected=0
|
||||
while IFS= read -r file; do
|
||||
if { cpp -w -fpreprocessed "$file" || exit "$?"; } | grep -E -- "$regex"; then
|
||||
echo "^ $file calls a function that has a safe counterpart."
|
||||
detected=1
|
||||
fi
|
||||
done << EOF
|
||||
$(find -name '*.c' -not -name safewrappers.c -not -name strndup.c)
|
||||
EOF
|
||||
if [ "$detected" -ne 0 ]; then
|
||||
echo
|
||||
echo "Calls of functions that have safe counterparts were detected."
|
||||
exit 1
|
||||
fi
|
||||
|
|
Loading…
Reference in New Issue