Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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?"
Expand Down
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
4 changes: 4 additions & 0 deletions externals/simplecpp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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()


4 changes: 4 additions & 0 deletions externals/tinyxml/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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()


5 changes: 4 additions & 1 deletion lib/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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()
13 changes: 13 additions & 0 deletions oss-fuzz/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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()
17 changes: 14 additions & 3 deletions oss-fuzz/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,22 @@ class CppcheckExecutor : public ErrorLogger {
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;
}
};


Expand Down