Skip to content

Commit

Permalink
oss-fuzz: decrease input size again
Browse files Browse the repository at this point in the history
  • Loading branch information
flavorjones committed Jul 29, 2024
1 parent 16a776a commit 47c1e82
Showing 1 changed file with 9 additions and 19 deletions.
28 changes: 9 additions & 19 deletions gumbo-parser/fuzzer/parse_fuzzer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -38,32 +38,22 @@ int SanityCheckPointers(const char* input, size_t input_length, const GumboNode*

extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
/* arbitrary upper size limit to avoid "out-of-memory in parse_fuzzer" reports */
if (size < 10 | size > 50000)
{
return 0;
if (size < 10 | size > 25000) {
return 0;
}

GumboOptions options = kGumboDefaultOptions;
GumboOutput* output;
GumboNode* root;
GumboOutput* output = gumbo_parse_with_options(&options, (char*)data, size);

output = gumbo_parse_with_options(&options, (char*)data, size);
root = output->document;

int result = SanityCheckPointers((char*)data, size, output->root, 0);

if (result < 0)
{
if (output) {
gumbo_destroy_output(output);
}

return -1;
}

if (output) {
gumbo_destroy_output(output);
}

return 0;
if (result < 0) {
return -1;
}

return 0;
}

0 comments on commit 47c1e82

Please sign in to comment.