Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Avoid OOM in refill fuzz test #497

Merged
merged 1 commit into from
Nov 12, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions fuzz/fuzz_targets/refill.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,13 @@ fuzz_target!(|input: (String, usize)| {
return; // Avoid timeouts in OSS-Fuzz.
}

let (_, options) = textwrap::unfill(&input.0);
if options.subsequent_indent.len() > 10_000 {
// Avoid out of memory in OSS-fuzz. The indentation is added
// on every line of the output, meaning that is can make the
// memory usage explode.
return;
}

let _ = textwrap::refill(&input.0, input.1);
});