Merge pull request #321 from libexpat/misc-fuzzing-bits

Misc fuzzing bits… including Travis CI integration
This commit is contained in:
Sebastian Pipping 2019-08-29 13:23:05 +02:00 committed by GitHub
commit 84b03ba11f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 12 additions and 6 deletions

View File

@ -53,7 +53,7 @@ elif [[ ${MODE} = cmake-oos ]]; then
mkdir build
cd build
cmake ${CMAKE_ARGS} ..
make all test
make VERBOSE=1 all test
make DESTDIR="${PWD}"/ROOT install
find ROOT -printf "%P\n" | sort
elif [[ ${MODE} = cppcheck ]]; then

View File

@ -24,7 +24,7 @@ matrix:
- os: linux
env: MODE=clang-format
- os: linux
env: MODE=cmake-oos CMAKE_ARGS=-DXML_ATTR_INFO=ON
env: MODE=cmake-oos CMAKE_ARGS="-DXML_ATTR_INFO=ON -DBUILD_fuzzers=ON -DCMAKE_C_FLAGS=-fsanitize=address -DCMAKE_CXX_FLAGS=-fsanitize=address -DCMAKE_EXE_LINKER_FLAGS=-fsanitize=address -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++"
- os: linux
env: MODE=qa-sh QA_COMPILER=clang CC=clang CXX=clang++ LD=clang++ QA_SANITIZER=address CONFIGURE_ARGS=--enable-xml-attr-info
- os: linux

View File

@ -326,10 +326,11 @@ if(BUILD_tests)
endif(BUILD_tests)
if(BUILD_fuzzers)
if(NOT "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
if(NOT "${CMAKE_C_COMPILER_ID}" STREQUAL "Clang")
message(SEND_ERROR
"Building fuzz targets without clang is not supported. Please set "
"-DCMAKE_C_COMPILER=clang.")
"Building fuzz targets without Clang (but ${CMAKE_C_COMPILER_ID}) "
"is not supported. Please set "
"-DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++.")
endif()
string(FIND "${CMAKE_EXE_LINKER_FLAGS}" "-fsanitize" sanitizer_present)
@ -338,6 +339,7 @@ if(BUILD_fuzzers)
"There was no sanitizer present when building the fuzz targets. "
"This is likely in error - consider adding "
"-DCMAKE_C_FLAGS='-fsanitize=<sanitizer>' and "
"-DCMAKE_CXX_FLAGS='-fsanitize=<sanitizer>' and "
"-DCMAKE_EXE_LINKER_FLAGS='-fsanitize=<sanitizer>' to your cmake "
"execution.")
endif()
@ -352,7 +354,8 @@ if(BUILD_fuzzers)
target_compile_definitions(${target_name}
PRIVATE ENCODING_FOR_FUZZING=${encoding_type})
target_compile_options(${target_name} PRIVATE -fsanitize=fuzzer-no-link)
target_link_options(${target_name} PRIVATE -fsanitize=fuzzer)
# NOTE: Avoiding target_link_options here only because it needs CMake >=3.13
set_target_properties(${target_name} PROPERTIES LINK_FLAGS -fsanitize=fuzzer)
set_property(
TARGET ${target_name} PROPERTY RUNTIME_OUTPUT_DIRECTORY fuzz)
endforeach()
@ -388,6 +391,7 @@ endif()
message(STATUS "")
message(STATUS " Build documentation ........ ${BUILD_doc}")
message(STATUS " Build examples ............. ${BUILD_examples}")
message(STATUS " Build fuzzers .............. ${BUILD_fuzzers}")
message(STATUS " Build tests ................ ${BUILD_tests}")
message(STATUS " Build tools (xmlwf) ........ ${BUILD_tools}")
message(STATUS " Install files .............. ${INSTALL}")

View File

@ -29,6 +29,7 @@ Release x.x.x xxx xxx xx xxxx
Old: expat[d].lib
New: expat[w][d].lib
CMake: Migrate files from Windows to Unix line endings
#308 CMake: Integrate OSS-Fuzz fuzzers
#299 #302 Windows: Replace LoadLibrary hack to access
unofficial API function SystemFunction036 (RtlGenRandom)
by using official API function rand_s (needs WinXP+)
@ -45,6 +46,7 @@ Release x.x.x xxx xxx xx xxxx
Khajapasha Mohammed
Kishore Kunche
Marco Maggi
Mitch Phillips
Rolf Ade
xantares