mirror of
https://github.com/vel21ripn/nDPI.git
synced 2026-04-29 23:49:41 +00:00
fuzz: extend fuzzing coverage (#2626)
This commit is contained in:
parent
c5bd9d8bff
commit
43f7dc9ba0
5 changed files with 26 additions and 8 deletions
|
|
@ -6,10 +6,15 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
|
|||
ndpi_MD5_CTX ctx;
|
||||
struct ndpi_popcount popcount;
|
||||
char *str;
|
||||
u_int len;
|
||||
u_char out[2048], out2[2048];
|
||||
int pseudo_bool;
|
||||
|
||||
/* No memory allocations involved */
|
||||
|
||||
/* Used for crc32, md5, hash(es) and popcount algs */
|
||||
/* Used for crc32, md5, hash(es), popcount and hex2bin algs */
|
||||
|
||||
pseudo_bool = (size % 2 == 0);
|
||||
|
||||
ndpi_crc16_ccit(data, size);
|
||||
ndpi_crc16_ccit_false(data, size);
|
||||
|
|
@ -44,8 +49,11 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
|
|||
}
|
||||
|
||||
|
||||
ndpi_popcount_init(&popcount);
|
||||
ndpi_popcount_count(&popcount, data, size);
|
||||
ndpi_popcount_init(pseudo_bool ? &popcount : NULL);
|
||||
ndpi_popcount_count(pseudo_bool ? &popcount : NULL, data, size);
|
||||
|
||||
len = ndpi_bin2hex(out, sizeof(out), (u_char *)data, size);
|
||||
ndpi_hex2bin(out2, sizeof(out2), out, len);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue