-
Notifications
You must be signed in to change notification settings - Fork 892
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fuzz: extend fuzzing coverage (#2052)
Added/merged some traces. Improved Socks identification
- Loading branch information
Showing
17 changed files
with
92 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,7 +7,7 @@ | |
#FTP_DATA | ||
|
||
"RIFF" | ||
"MZ" | ||
"MZ\x00" | ||
"OggS" | ||
"PK\x03\x04" | ||
"\x00\x00\x01\xBA" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
#include "ndpi_api.h" | ||
#include "fuzz_common_code.h" | ||
|
||
#include <stdint.h> | ||
#include "fuzzer/FuzzedDataProvider.h" | ||
|
||
extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) { | ||
FuzzedDataProvider fuzzed_data(data, size); | ||
struct ndpi_cm_sketch *sketch; | ||
u_int16_t i, num_hashes, num_iteration, num_lookup; | ||
|
||
/* Just to have some data */ | ||
if (fuzzed_data.remaining_bytes() < 1024) | ||
return -1; | ||
|
||
/* To allow memory allocation failures */ | ||
fuzz_set_alloc_callbacks_and_seed(size); | ||
|
||
num_hashes = fuzzed_data.ConsumeIntegralInRange(0, 8192); | ||
num_iteration = fuzzed_data.ConsumeIntegral<u_int8_t>(); | ||
num_lookup = fuzzed_data.ConsumeIntegral<u_int8_t>(); | ||
|
||
sketch = ndpi_cm_sketch_init(num_hashes); | ||
if (sketch) { | ||
for (i = 0; i < num_iteration; i++) { | ||
ndpi_cm_sketch_add(sketch, fuzzed_data.ConsumeIntegral<u_int32_t>()); | ||
} | ||
for (i = 0; i < num_lookup; i++) { | ||
ndpi_cm_sketch_count(sketch, fuzzed_data.ConsumeIntegral<u_int32_t>()); | ||
} | ||
ndpi_cm_sketch_destroy(sketch); | ||
} | ||
|
||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file renamed
BIN
+8.93 KB
...cfgs/default/pcap/socks-http-example.pcap → tests/cfgs/default/pcap/socks.pcap
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters