fixed OSS-Fuzz builds and added CMake targets (#2577)
* fixed compilation of OSS-Fuzz clients * added preliminary CMake target for fuzz-client - also added *_sanitized targets of dependencies (only available with Clang) * added oss-fuzz build to Travis CI
This commit is contained in:
parent
c78e3e7c03
commit
28cd5d7ea2
|
@ -164,6 +164,8 @@ matrix:
|
|||
- ./testrunner TestSymbolDatabase
|
||||
# check .json files
|
||||
- find . -name '*.json' -not -path '*/\.*' | xargs jsonlint -s
|
||||
# build OSS-Fuzz clients
|
||||
- make -j2 CXXFLAGS="-fsanitize=address" -C oss-fuzz
|
||||
|
||||
# check if dmake needs to be rerun (this job may fail)
|
||||
- name: "rerun dmake?"
|
||||
|
|
|
@ -28,5 +28,6 @@ add_subdirectory(cli) # Client application
|
|||
add_subdirectory(test) # Tests
|
||||
ADD_SUBDIRECTORY(gui) # Graphical application
|
||||
ADD_SUBDIRECTORY(tools/triage) # Triage tool
|
||||
add_subdirectory(oss-fuzz) # OSS-Fuzz clients
|
||||
|
||||
include(cmake/printInfo.cmake REQUIRED)
|
||||
|
|
|
@ -2,5 +2,9 @@ file(GLOB hdrs "*.h")
|
|||
file(GLOB srcs "*.cpp")
|
||||
|
||||
add_library(simplecpp_objs OBJECT ${srcs} ${hdrs})
|
||||
if (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
|
||||
add_library(simplecpp_objs_sanitized OBJECT ${srcs} ${hdrs})
|
||||
target_compile_options(simplecpp_objs_sanitized PRIVATE -fsanitize=address)
|
||||
endif()
|
||||
|
||||
|
||||
|
|
|
@ -2,5 +2,9 @@ file(GLOB hdrs "*.h")
|
|||
file(GLOB srcs "*.cpp")
|
||||
|
||||
add_library(tinyxml_objs OBJECT ${srcs} ${hdrs})
|
||||
if (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
|
||||
add_library(tinyxml_objs_sanitized OBJECT ${srcs} ${hdrs})
|
||||
target_compile_options(tinyxml_objs_sanitized PRIVATE -fsanitize=address)
|
||||
endif()
|
||||
|
||||
|
||||
|
|
|
@ -37,4 +37,7 @@ else()
|
|||
endif()
|
||||
|
||||
add_library(lib_objs OBJECT ${srcs_lib} ${hdrs})
|
||||
|
||||
if (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
|
||||
add_library(lib_objs_sanitized OBJECT ${srcs_lib} ${hdrs})
|
||||
target_compile_options(lib_objs_sanitized PRIVATE -fsanitize=address)
|
||||
endif()
|
||||
|
|
|
@ -0,0 +1,13 @@
|
|||
if (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
|
||||
add_executable(fuzz-client
|
||||
main.cpp
|
||||
type2.cpp)
|
||||
target_include_directories(fuzz-client PRIVATE ${CMAKE_SOURCE_DIR}/lib ${CMAKE_SOURCE_DIR}/externals/simplecpp ${CMAKE_SOURCE_DIR}/externals/tinyxml ${CMAKE_SOURCE_DIR}/externals)
|
||||
target_compile_options(fuzz-client PRIVATE -fsanitize=fuzzer)
|
||||
target_link_libraries(fuzz-client PRIVATE simplecpp_objs_sanitized tinyxml_objs_sanitized lib_objs_sanitized)
|
||||
target_link_options(fuzz-client PRIVATE -fsanitize=address -fsanitize=fuzzer)
|
||||
|
||||
add_executable(translate
|
||||
translate.cpp
|
||||
type2.cpp)
|
||||
endif()
|
|
@ -19,11 +19,22 @@ public:
|
|||
cppcheck.check("test.cpp", code);
|
||||
}
|
||||
|
||||
void reportOut(const std::string &outmsg) { }
|
||||
void reportErr(const ErrorLogger::ErrorMessage &msg) {}
|
||||
void reportOut(const std::string &outmsg) OVERRIDE {
|
||||
(void)outmsg;
|
||||
}
|
||||
void reportErr(const ErrorLogger::ErrorMessage &msg) OVERRIDE {
|
||||
(void)msg;
|
||||
}
|
||||
void reportProgress(const std::string& filename,
|
||||
const char stage[],
|
||||
const unsigned int value) {}
|
||||
const std::size_t value) OVERRIDE {
|
||||
(void)filename;
|
||||
(void)stage;
|
||||
(void)value;
|
||||
}
|
||||
void bughuntingReport(const std::string &str) OVERRIDE {
|
||||
(void)str;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue