Skip to content

Commit 2c5dfe5

Browse files
authored
We must limit the input sizes (#395)
1 parent a252dcd commit 2c5dfe5

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

fuzz/parse.cc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,16 @@
77

88
extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
99
FuzzedDataProvider fdp(data, size);
10-
std::string source = fdp.ConsumeRandomLengthString();
11-
std::string base_source = fdp.ConsumeRandomLengthString();
10+
std::string source = fdp.ConsumeRandomLengthString(256);
11+
std::string base_source = fdp.ConsumeRandomLengthString(256);
1212

1313
/**
1414
* ada::parse<ada::url>
1515
*/
1616
auto out_url = ada::parse<ada::url>(source);
1717

1818
if (out_url) {
19-
std::string input = fdp.ConsumeRandomLengthString();
19+
std::string input = fdp.ConsumeRandomLengthString(256);
2020
out_url->set_protocol(input);
2121
out_url->set_username(input);
2222
out_url->set_password(input);
@@ -33,7 +33,7 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
3333
auto out_aggregator = ada::parse<ada::url_aggregator>(source);
3434

3535
if (out_aggregator) {
36-
std::string input = fdp.ConsumeRandomLengthString();
36+
std::string input = fdp.ConsumeRandomLengthString(256);
3737
out_aggregator->set_protocol(input);
3838
out_aggregator->set_username(input);
3939
out_aggregator->set_password(input);

0 commit comments

Comments
 (0)