Limit postprocess heuristics fuzz input size#2644
Conversation
3439244 to
e8170f9
Compare
A ClusterFuzz testcase for the postprocess_heuristics target spent about 13.8 seconds in a single release-mode fuzzer run locally. The timeout happens while computing the diff for an unusually large input, before the post-processing heuristics run. Skip fuzz inputs whose parsed before/after strings exceed 128 KiB in total. This keeps the guard fuzz-target-local so the public diff API continues to handle large inputs without silently producing partial results, while preventing the reported oversized testcase from consuming the target budget. Co-authored-by: Sebastian Thiel <[email protected]>
e8170f9 to
20649b1
Compare
|
And it's clear that this fuzzer input is stress for Myers, not for post-processing in general. Yes, but my read is: the report is more a Key signals:
There may be real optimization opportunities, but I would separate them:
So: I would not conclude that post-processing is broadly too slow from this reproducer. I would conclude that huge, adversarial, repetitive inputs can make the full diff pipeline expensive, and the fuzzer target multiplies that cost. If we wanted a follow-up performance patch, I’d look first at indent-level caching and maybe a Myers recursion-depth guard or explicit work stack. |
There was a problem hiding this comment.
Pull request overview
Limits the gix-imara-diff postprocess_heuristics fuzz target to avoid pathological slow inputs by skipping cases where the combined before/after input size exceeds 128 KiB, improving fuzzer runtime stability without changing the library’s behavior for real consumers.
Changes:
- Add a fuzz-target-local
MAX_INPUT_BYTESguard that early-returns whenbefore.len() + after.len()exceeds 128 KiB. - Minor formatting tweak to the
IndentLevel::for_ascii_line(...)call site.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Tasks
Created by Codex on behalf of Byron. Byron will review before this is ready to merge.
Summary
Limit the
gix-imara-diffpostprocess_heuristicsfuzz target to inputs whose parsedbeforeandafterstrings are at most 128 KiB in total. The guard is fuzz-target-local and contained infuzz_targets/postprocess_heuristics.rs, so the public diff API still handles large inputs normally.Reported issue
Plain-text report from the session:
Notes
Local measurements:
Validation
cargo +nightly fuzz run --fuzz-dir gix-imara-diff/fuzz postprocess_heuristics ../clusterfuzz-testcase-minimized-gix-imara-diff-postprocess_heuristics-4774375640072192 -- -runs=100cargo test --manifest-path gix-imara-diff/fuzz/Cargo.tomlcargo test -p gix-imara-diffcodex review --commit e8170f92363380c16e9f028564709dfad1720a0b