Show More
@@ -9,22 +9,20 b'' | |||
|
9 | 9 | #include <memory> |
|
10 | 10 | #include <stdlib.h> |
|
11 | 11 | |
|
12 |
#include |
|
|
12 | #include <fuzzer/FuzzedDataProvider.h> | |
|
13 | 13 | |
|
14 | 14 | extern "C" { |
|
15 | 15 | #include "bdiff.h" |
|
16 | 16 | |
|
17 | 17 | int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) |
|
18 | 18 | { |
|
19 | auto maybe_inputs = SplitInputs(Data, Size); | |
|
20 | if (!maybe_inputs) { | |
|
21 | return 0; | |
|
22 | } | |
|
23 | auto inputs = std::move(maybe_inputs.value()); | |
|
19 | FuzzedDataProvider provider(Data, Size); | |
|
20 | std::string left = provider.ConsumeRandomLengthString(Size); | |
|
21 | std::string right = provider.ConsumeRemainingBytesAsString(); | |
|
24 | 22 | |
|
25 | 23 | struct bdiff_line *a, *b; |
|
26 |
int an = bdiff_splitlines( |
|
|
27 |
int bn = bdiff_splitlines( |
|
|
24 | int an = bdiff_splitlines(left.c_str(), left.size(), &a); | |
|
25 | int bn = bdiff_splitlines(right.c_str(), right.size(), &b); | |
|
28 | 26 | struct bdiff_hunk l; |
|
29 | 27 | bdiff_diff(a, an, b, bn, &l); |
|
30 | 28 | free(a); |
General Comments 0
You need to be logged in to leave comments.
Login now