2022-05-18 10:44:39 +02:00
|
|
|
|
# Copyright 2018 pdknsk
|
|
|
|
|
# Copyright 2020, 2021, 2022 Endless OS Foundation, LLC
|
|
|
|
|
#
|
|
|
|
|
# SPDX-License-Identifier: LGPL-2.1-or-later
|
|
|
|
|
#
|
|
|
|
|
# This library is free software; you can redistribute it and/or
|
|
|
|
|
# modify it under the terms of the GNU Lesser General Public
|
|
|
|
|
# License as published by the Free Software Foundation; either
|
|
|
|
|
# version 2.1 of the License, or (at your option) any later version.
|
|
|
|
|
#
|
|
|
|
|
# This library is distributed in the hope that it will be useful,
|
|
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
|
# Lesser General Public License for more details.
|
|
|
|
|
#
|
|
|
|
|
# You should have received a copy of the GNU Lesser General Public
|
|
|
|
|
# License along with this library; if not, see <http://www.gnu.org/licenses/>.
|
|
|
|
|
|
2018-10-11 02:02:03 +02:00
|
|
|
|
fuzz_targets = [
|
|
|
|
|
'fuzz_bookmark',
|
2021-03-24 12:16:49 +01:00
|
|
|
|
'fuzz_canonicalize_filename',
|
2020-12-08 12:02:54 +01:00
|
|
|
|
'fuzz_date_parse',
|
|
|
|
|
'fuzz_date_time_new_from_iso8601',
|
2018-10-11 02:02:03 +02:00
|
|
|
|
'fuzz_dbus_message',
|
2020-12-08 12:02:54 +01:00
|
|
|
|
'fuzz_inet_address_mask_new_from_string',
|
|
|
|
|
'fuzz_inet_address_new_from_string',
|
|
|
|
|
'fuzz_inet_socket_address_new_from_string',
|
2018-10-11 02:02:03 +02:00
|
|
|
|
'fuzz_key',
|
2020-12-08 12:02:54 +01:00
|
|
|
|
'fuzz_network_address_parse',
|
|
|
|
|
'fuzz_network_address_parse_uri',
|
2021-03-24 12:16:49 +01:00
|
|
|
|
'fuzz_paths',
|
2021-12-15 17:56:51 +01:00
|
|
|
|
'fuzz_resolver',
|
2020-06-19 12:54:41 +02:00
|
|
|
|
'fuzz_uri_escape',
|
|
|
|
|
'fuzz_uri_parse',
|
|
|
|
|
'fuzz_uri_parse_params',
|
2023-04-14 17:50:47 +02:00
|
|
|
|
'fuzz_utf8_normalize',
|
2022-11-07 13:56:31 +01:00
|
|
|
|
'fuzz_utf8_validate',
|
2022-06-10 17:12:48 +02:00
|
|
|
|
'fuzz_uuid_string_is_valid',
|
2018-10-11 02:02:03 +02:00
|
|
|
|
'fuzz_variant_binary',
|
2022-10-27 13:13:13 +02:00
|
|
|
|
'fuzz_variant_binary_byteswap',
|
2018-10-11 02:02:03 +02:00
|
|
|
|
'fuzz_variant_text',
|
|
|
|
|
]
|
|
|
|
|
|
|
|
|
|
deps = [libgmodule_dep, libgio_dep, libglib_dep, libgobject_dep]
|
|
|
|
|
|
|
|
|
|
extra_sources = []
|
|
|
|
|
extra_c_args = cc.get_supported_arguments('-Werror=unused-function')
|
|
|
|
|
|
|
|
|
|
# Links in a static library provided by oss-fuzz, else a standalone driver.
|
2021-06-07 14:16:50 +02:00
|
|
|
|
# https://google.github.io/oss-fuzz/getting-started/new-project-guide/#buildsh-script-environment
|
2022-07-15 08:23:37 +02:00
|
|
|
|
have_fuzzing_engine = false
|
|
|
|
|
if have_cxx
|
|
|
|
|
fuzzing_engine = cxx.find_library('FuzzingEngine', required : get_option('oss_fuzz'))
|
|
|
|
|
have_fuzzing_engine = fuzzing_engine.found()
|
|
|
|
|
endif
|
|
|
|
|
if have_fuzzing_engine
|
2018-10-11 02:02:03 +02:00
|
|
|
|
deps += fuzzing_engine
|
|
|
|
|
else
|
|
|
|
|
extra_sources += 'driver.c'
|
|
|
|
|
endif
|
|
|
|
|
|
|
|
|
|
foreach target_name : fuzz_targets
|
|
|
|
|
exe = executable(target_name, [extra_sources, target_name + '.c'],
|
|
|
|
|
c_args : extra_c_args,
|
|
|
|
|
dependencies : deps,
|
|
|
|
|
)
|
2022-05-05 15:06:08 +02:00
|
|
|
|
|
|
|
|
|
# If the FuzzingEngine isn’t available, build some unit tests to check that
|
|
|
|
|
# the fuzzing files do basically work. This doesn’t do any actual fuzzing though.
|
|
|
|
|
# Pass in the README as an arbitrary fuzzing input, just so we have something.
|
2023-03-10 12:11:11 +01:00
|
|
|
|
if build_tests and not have_fuzzing_engine
|
2022-05-05 15:06:08 +02:00
|
|
|
|
test(target_name, exe,
|
|
|
|
|
args : files('README.md'),
|
|
|
|
|
suite : 'fuzzing',
|
|
|
|
|
)
|
|
|
|
|
endif
|
2018-10-11 02:02:03 +02:00
|
|
|
|
endforeach
|