Line | Count | Source |
1 | | /* |
2 | | * Copyright (C) 2023 Emweb bv, Herent, Belgium. |
3 | | * |
4 | | * See the LICENSE file for terms of use. |
5 | | */ |
6 | | |
7 | | #include <stdint.h> |
8 | | #include <stddef.h> |
9 | | #include <string> |
10 | | |
11 | | #include <Wt/Json/Parser.h> |
12 | | #include <Wt/Json/Object.h> |
13 | | |
14 | 6.54k | #define kMinInputLength 10 |
15 | 3.26k | #define kMaxInputLength 5120 |
16 | | |
17 | | using namespace Wt; |
18 | | |
19 | 3.27k | extern "C" int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) { |
20 | | |
21 | 3.27k | if (Size < kMinInputLength || Size > kMaxInputLength) { |
22 | 18 | return 1; |
23 | 18 | } |
24 | | |
25 | 3.25k | std::string data(Data, Data + Size); |
26 | | |
27 | 3.25k | try { |
28 | 3.25k | Json::Object initial; |
29 | 3.25k | Json::parse(data, initial); |
30 | 3.25k | }catch( ... ){ /* ... */} |
31 | | |
32 | 3.25k | try { |
33 | 3.25k | Json::Value initial; |
34 | 3.25k | Json::parse(data, initial); |
35 | 3.25k | }catch( ... ){ /* ... */} |
36 | | |
37 | 3.25k | return 0; |
38 | 3.25k | } |