xref: /btstack/test/fuzz/fuzz_hfp_at_parser.c (revision cd5f23a3250874824c01a2b3326a9522fea3f99f)
1 #include <stdint.h>
2 #include <stddef.h>
3 
4 #include "classic/hfp.h"
5 
6 int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
7     // test ad iterator by calling simple function that uses it
8     if (size < 1) return 0;
9 
10     int is_handsfree = data[0] & 1;
11     hfp_connection_t hfp_connection;
12     memset(&hfp_connection, 0, sizeof(hfp_connection_t));
13 
14     uint32_t i;
15     for (i = 1; i < size; i++){
16         hfp_parse(&hfp_connection, data[i], is_handsfree);
17     }
18 
19     return 0;
20 }
21