diff --git a/test/fuzz/.gitignore b/test/fuzz/.gitignore index 04612ce5f..f0db76312 100644 --- a/test/fuzz/.gitignore +++ b/test/fuzz/.gitignore @@ -1,14 +1,15 @@ +build +cmake-build-debug +cmake_install.cmake CMakeCache.txt CMakeFiles crash-* default.profraw -build -Makefile -cmake-build-debug -cmake_install.cmake -fuzz_hci -fuzz_hci_transport_h4 fuzz_ad_parser fuzz_att_db fuzz_gatt_client +fuzz_hci +fuzz_hci_transport_h4 +fuzz_hfp_at_parser libbtstack.a +Makefile diff --git a/test/fuzz/fuzz_hfp_at_parser.c b/test/fuzz/fuzz_hfp_at_parser.c new file mode 100644 index 000000000..0ae19c295 --- /dev/null +++ b/test/fuzz/fuzz_hfp_at_parser.c @@ -0,0 +1,20 @@ +#include +#include + +#include "classic/hfp.h" + +int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) { + // test ad iterator by calling simple function that uses it + if (size < 1) return 0; + + int is_handsfree = data[0] & 1; + hfp_connection_t hfp_connection; + memset(&hfp_connection, 0, sizeof(hfp_connection_t)); + + uint32_t i; + for (i = 1; i < size; i++){ + hfp_parse(&hfp_connection, data[i], is_handsfree); + } + + return 0; +} diff --git a/test/hfp/.gitignore b/test/hfp/.gitignore index 36bffa6d6..32a1f020b 100644 --- a/test/hfp/.gitignore +++ b/test/hfp/.gitignore @@ -1,7 +1,8 @@ -hfp_hf_client_test -hfp_ag_client_test -hfp_hf_parser_test -hfp_ag_parser_test cvsd_plc_test -results/* +hfp_ag_client_test +hfp_ag_parser_test +hfp_at_parser_test +hfp_hf_client_test +hfp_hf_parser_test pklg_cvsd_test +results/*