Skip to content

json-fuzz: prevent large size inputs#40855

Merged
botengyao merged 2 commits intoenvoyproxy:mainfrom
adisuissa:fuzz_bug_421951268
Aug 26, 2025
Merged

json-fuzz: prevent large size inputs#40855
botengyao merged 2 commits intoenvoyproxy:mainfrom
adisuissa:fuzz_bug_421951268

Conversation

@adisuissa
Copy link
Contributor

Commit Message: json-fuzz: prevent large size inputs
Additional Description:
The original fuzzer test-case created a large input file with ~1MiB of base64 contents that was truncated in the middle and caused the fuzzer to OOM due to a test-function allocation:

#9 0x5ca72f569401 in testing::internal::edit_distance::CreateUnifiedDiff(std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>>> const&, std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>>> const&, unsigned long) /proc/self/cwd/external/com_google_googletest/googletest/src/gtest.cc:1352:39

This PR limits the input sizes for the json input to 32KiB, as most errors should be detected with this limit.

Risk Level: low - tests only
Testing: N/A
Docs Changes: N/A
Release Notes: N/A
Platform Specific Features: N/A
Fixes fuzz issue 421951268.

Signed-off-by: Adi Suissa-Peleg <adip@google.com>
@repokitteh-read-only
Copy link

As a reminder, PRs marked as draft will not be automatically assigned reviewers,
or be handled by maintainer-oncall triage.

Please mark your PR as ready when you want it to be reviewed!

🐱

Caused by: #40855 was opened by adisuissa.

see: more, trace.

@adisuissa adisuissa marked this pull request as ready for review August 26, 2025 13:36
botengyao
botengyao previously approved these changes Aug 26, 2025
Copy link
Member

@botengyao botengyao left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for addressing this!

Signed-off-by: Adi Suissa-Peleg <adip@google.com>
Copy link
Member

@botengyao botengyao left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm, thanks!

@botengyao botengyao merged commit 0b431b3 into envoyproxy:main Aug 26, 2025
24 checks passed
wtzhang23 pushed a commit to wtzhang23/envoy that referenced this pull request Aug 27, 2025
Commit Message: json-fuzz: prevent large size inputs
Additional Description:
The original [fuzzer
test-case](https://oss-fuzz.com/testcase-detail/4819251528007680)
created a large input file with ~1MiB of base64 contents that was
truncated in the middle and caused the fuzzer to OOM due to a
test-function allocation:
```
envoyproxy#9 0x5ca72f569401 in testing::internal::edit_distance::CreateUnifiedDiff(std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>>> const&, std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>>> const&, unsigned long) /proc/self/cwd/external/com_google_googletest/googletest/src/gtest.cc:1352:39
```

This PR limits the input sizes for the json input to 32KiB, as most
errors should be detected with this limit.

Risk Level: low - tests only
Testing: N/A
Docs Changes: N/A
Release Notes: N/A
Platform Specific Features: N/A
Fixes fuzz issue
[421951268](https://issues.oss-fuzz.com/issues/421951268).

---------

Signed-off-by: Adi Suissa-Peleg <adip@google.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants