Skip to content

Commit

Permalink
fix: libfuzzer build
Browse files Browse the repository at this point in the history
  • Loading branch information
cktii committed Nov 25, 2024
1 parent 0f2a9c3 commit a329b3b
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
11 changes: 10 additions & 1 deletion fuzz/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
# meson setup builddir --native-file libfuzzer.ini -Dfuzzing=true
# Finally, call ninja -C builddir


src_common = include_directories('../src/common')
mavlink_extra = [
include_directories('../modules/mavlink_c_library_v2'),
Expand All @@ -21,6 +20,8 @@ mavlink_parse_char_harness = executable(
dep_rt,
dep_thread
],
cpp_args: fuzzer_flags,
link_args: fuzzer_link_flags,
install: false
)

Expand All @@ -40,6 +41,8 @@ mavlink_conf_parser_harness = executable(
dep_rt,
dep_thread
],
cpp_args: fuzzer_flags,
link_args: fuzzer_link_flags,
install: false
)

Expand All @@ -66,6 +69,8 @@ ulog_harness = executable(
dep_rt,
dep_thread
],
cpp_args: fuzzer_flags,
link_args: fuzzer_link_flags,
install: false
)

Expand All @@ -91,6 +96,8 @@ alog_harness = executable(
dep_rt,
dep_thread
],
cpp_args: fuzzer_flags,
link_args: fuzzer_link_flags,
install: false
)

Expand All @@ -115,6 +122,8 @@ blog_harness = executable(
dep_rt,
dep_thread
],
cpp_args: fuzzer_flags,
link_args: fuzzer_link_flags,
install: false
)

8 changes: 8 additions & 0 deletions meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,14 @@ endif

dep_gtest = dependency('gtest', main : true, required : false)

fuzzer_flags = []
fuzzer_link_flags = []

if get_option('fuzzing')
fuzzer_flags = ['-fsanitize=fuzzer,address,undefined']
fuzzer_link_flags = ['-fsanitize=fuzzer,address,undefined']
endif

# Additional warnings
possible_cc_flags = [
'-Wno-inline',
Expand Down

0 comments on commit a329b3b

Please sign in to comment.