diff --git a/UEFITool/CMakeLists.txt b/UEFITool/CMakeLists.txt index bef8a7e..1b08428 100644 --- a/UEFITool/CMakeLists.txt +++ b/UEFITool/CMakeLists.txt @@ -8,25 +8,6 @@ SET(CMAKE_CXX_EXTENSIONS OFF) FIND_PACKAGE(Qt6 REQUIRED COMPONENTS Widgets) -IF (CMAKE_CXX_COMPILER_ID MATCHES "Clang") -# Enable sanitizers for debug builds done by Clang - IF(CMAKE_BUILD_TYPE MATCHES Debug) - MESSAGE("-- Clang sanitizers enabled") - ADD_COMPILE_OPTIONS(-fno-omit-frame-pointer) - ADD_LINK_OPTIONS(-fno-omit-frame-pointer) - ADD_COMPILE_OPTIONS(-fsanitize=undefined) - ADD_LINK_OPTIONS(-fsanitize=undefined) - ADD_COMPILE_OPTIONS(-fsanitize=integer) - ADD_LINK_OPTIONS(-fsanitize=integer) - ADD_COMPILE_OPTIONS(-fsanitize=nullability) - ADD_LINK_OPTIONS(-fsanitize=nullability) - ADD_COMPILE_OPTIONS(-fsanitize=implicit-conversion) - ADD_LINK_OPTIONS(-fsanitize=implicit-conversion) - ADD_COMPILE_OPTIONS(-fsanitize=array-bounds) - ADD_LINK_OPTIONS(-fsanitize=array-bounds) - ENDIF() -ENDIF() - SET(PROJECT_FORMS uefitool.ui searchdialog.ui diff --git a/fuzzing/CMakeLists.txt b/fuzzing/CMakeLists.txt index 0f99ac2..d656663 100644 --- a/fuzzing/CMakeLists.txt +++ b/fuzzing/CMakeLists.txt @@ -1,6 +1,8 @@ CMAKE_MINIMUM_REQUIRED(VERSION 3.1.0 FATAL_ERROR) -PROJECT(ffsparser_fuzzer) +PROJECT(ffsparser_fuzzer LANGUAGES C CXX) + +OPTION(USE_QT "Link against Qt" ON) SET(CMAKE_CXX_STANDARD 11) SET(CMAKE_CXX_STANDARD_REQUIRED ON) @@ -14,6 +16,7 @@ SET(PROJECT_SOURCES ../common/ffs.cpp ../common/nvram.cpp ../common/nvramparser.cpp + ../common/meparser.cpp ../common/ffsparser.cpp ../common/fitparser.cpp ../common/peimage.cpp @@ -27,8 +30,6 @@ SET(PROJECT_SOURCES ../common/LZMA/SDK/C/LzmaDec.c ../common/Tiano/EfiTianoDecompress.c ../common/ustring.cpp - ../common/bstrlib/bstrlib.c - ../common/bstrlib/bstrwrap.cpp ../common/generated/intel_acbp_v1.cpp ../common/generated/intel_acbp_v2.cpp ../common/generated/intel_keym_v1.cpp @@ -56,10 +57,30 @@ SET(PROJECT_SOURCES ../common/zlib/zutil.c ) -ADD_DEFINITIONS(-DU_ENABLE_NVRAM_PARSING_SUPPORT -DU_ENABLE_FIT_PARSING_SUPPORT) +IF(NOT USE_QT) + SET(PROJECT_SOURCES ${PROJECT_SOURCES} + ../common/bstrlib/bstrlib.c + ../common/bstrlib/bstrwrap.cpp + ) + MESSAGE("-- Using non-Qt implementations") +ELSE() + FIND_PACKAGE(Qt6 REQUIRED COMPONENTS Core) + MESSAGE("-- Using Qt version: ${Qt6_VERSION}") +ENDIF() + +ADD_DEFINITIONS( + -DU_ENABLE_NVRAM_PARSING_SUPPORT + -DU_ENABLE_ME_PARSING_SUPPORT + -DU_ENABLE_FIT_PARSING_SUPPORT + -DU_ENABLE_GUID_DATABASE_SUPPORT +) ADD_EXECUTABLE(ffsparser_fuzzer ${PROJECT_SOURCES}) -TARGET_COMPILE_OPTIONS(ffsparser_fuzzer PRIVATE -g -O1 -fsanitize=fuzzer) +TARGET_COMPILE_OPTIONS(ffsparser_fuzzer PRIVATE -O1 -fno-omit-frame-pointer -g -ggdb3 -fsanitize=fuzzer,address,undefined -fsanitize-address-use-after-scope -fno-sanitize-recover=undefined) -TARGET_LINK_LIBRARIES(ffsparser_fuzzer PRIVATE -fsanitize=fuzzer) +TARGET_LINK_LIBRARIES(ffsparser_fuzzer PRIVATE -fsanitize=fuzzer,address,undefined) + +IF(USE_QT) + TARGET_LINK_LIBRARIES(ffsparser_fuzzer PRIVATE Qt6::Core) +ENDIF()