Fuzzing: build with Qt6 support by default, enable all parsers

This commit is contained in:
Nikolaj Schlej 2023-02-13 18:13:23 -08:00
parent 209fbb6282
commit 38854e945a
2 changed files with 27 additions and 25 deletions

View File

@ -8,25 +8,6 @@ SET(CMAKE_CXX_EXTENSIONS OFF)
FIND_PACKAGE(Qt6 REQUIRED COMPONENTS Widgets) 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 SET(PROJECT_FORMS
uefitool.ui uefitool.ui
searchdialog.ui searchdialog.ui

View File

@ -1,6 +1,8 @@
CMAKE_MINIMUM_REQUIRED(VERSION 3.1.0 FATAL_ERROR) 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 11)
SET(CMAKE_CXX_STANDARD_REQUIRED ON) SET(CMAKE_CXX_STANDARD_REQUIRED ON)
@ -14,6 +16,7 @@ SET(PROJECT_SOURCES
../common/ffs.cpp ../common/ffs.cpp
../common/nvram.cpp ../common/nvram.cpp
../common/nvramparser.cpp ../common/nvramparser.cpp
../common/meparser.cpp
../common/ffsparser.cpp ../common/ffsparser.cpp
../common/fitparser.cpp ../common/fitparser.cpp
../common/peimage.cpp ../common/peimage.cpp
@ -27,8 +30,6 @@ SET(PROJECT_SOURCES
../common/LZMA/SDK/C/LzmaDec.c ../common/LZMA/SDK/C/LzmaDec.c
../common/Tiano/EfiTianoDecompress.c ../common/Tiano/EfiTianoDecompress.c
../common/ustring.cpp ../common/ustring.cpp
../common/bstrlib/bstrlib.c
../common/bstrlib/bstrwrap.cpp
../common/generated/intel_acbp_v1.cpp ../common/generated/intel_acbp_v1.cpp
../common/generated/intel_acbp_v2.cpp ../common/generated/intel_acbp_v2.cpp
../common/generated/intel_keym_v1.cpp ../common/generated/intel_keym_v1.cpp
@ -56,10 +57,30 @@ SET(PROJECT_SOURCES
../common/zlib/zutil.c ../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}) 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()