Skip to content

Commit

Permalink
[Fuzzing] Adding all-clusters-app fuzz test to OSS-Fuzz (#35408)
Browse files Browse the repository at this point in the history
* Added a base38 rountrip Fuzzer to fuzz the encoding and decoding in base38
Added a base38 decoder Fuzzer to fuzz the function decoding base38 strings
Added a dependancy in TLV-Reader config to correct the build error

* adding all clusters

* Restyled by gn

* Moving this back

* Restyled by gn

* Update src/setup_payload/tests/FuzzBase38.cpp

Co-authored-by: Boris Zbarsky <[email protected]>

* Update src/setup_payload/tests/FuzzBase38.cpp

Co-authored-by: Boris Zbarsky <[email protected]>

* Update src/setup_payload/tests/FuzzBase38.cpp

Co-authored-by: Boris Zbarsky <[email protected]>

* Removing this

* Updating

* Update src/setup_payload/tests/FuzzBase38Decode.cpp

Co-authored-by: Boris Zbarsky <[email protected]>

* restrict activation of enable_fuzz_test_targets

---------

Co-authored-by: Justin Wood <[email protected]>
Co-authored-by: Restyled.io <[email protected]>
Co-authored-by: Boris Zbarsky <[email protected]>
  • Loading branch information
4 people authored and pull[bot] committed Sep 11, 2024
1 parent 38a9e1a commit 1283704
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 2 deletions.
1 change: 1 addition & 0 deletions BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ if (current_toolchain != "${dir_pw_toolchain}/default:default") {
if (enable_fuzz_test_targets) {
group("fuzz_tests") {
deps = [
"${chip_root}/examples/all-clusters-app/linux:fuzz-chip-all-clusters-app",
"${chip_root}/src/credentials/tests:fuzz-chip-cert",
"${chip_root}/src/lib/core/tests:fuzz-tlv-reader",
"${chip_root}/src/lib/dnssd/minimal_mdns/tests:fuzz-minmdns-packet-parsing",
Expand Down
7 changes: 5 additions & 2 deletions build/chip/fuzz_test.gni
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,12 @@ import("${chip_root}/build/chip/tests.gni")
import("${dir_pw_unit_test}/test.gni")

declare_args() {
enable_fuzz_test_targets = is_clang && chip_build_tests &&
(current_os == "linux" || current_os == "mac")
#Fuzz testing using libfuzzer
enable_fuzz_test_targets =
(is_libfuzzer || oss_fuzz) && is_clang && chip_build_tests &&
(current_os == "linux" || current_os == "mac")

#Fuzz testing using pw_fuzzer and FuzzTest Framework
pw_enable_fuzz_test_targets = false
}

Expand Down
11 changes: 11 additions & 0 deletions examples/all-clusters-app/linux/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import("${build_root}/config/compiler/compiler.gni")
import("${chip_root}/src/lib/lib.gni")
import("${chip_root}/src/platform/device.gni")

import("${chip_root}/build/chip/fuzz_test.gni")
import("${chip_root}/examples/common/pigweed/pigweed_rpcs.gni")

if (chip_enable_pw_rpc) {
Expand Down Expand Up @@ -201,3 +202,13 @@ group("linux") {
group("default") {
deps = [ ":linux" ]
}

if (enable_fuzz_test_targets) {
chip_fuzz_target("fuzz-chip-all-clusters-app") {
sources = [ "fuzzing-main.cpp" ]
public_deps = [
":chip-all-clusters-common",
"${chip_root}/examples/platform/linux:app-main",
]
}
}

0 comments on commit 1283704

Please sign in to comment.