Skip to content

Conversation

@mattsu2020
Copy link
Contributor

Summary

Prevent unbounded line buffering in fmt by introducing a capped, incremental line reader.
Split oversized paragraphs by byte/line thresholds to keep memory bounded on infinite input.

related
#10580

Prevent potential memory exhaustion when processing inputs without newlines or paragraph breaks by adding size limits:
- Maximum line length: 1 MiB
- Maximum paragraph size: 1
Replace explicit match on Result with if let pattern for cleaner error handling in the buffer fill operation. This change maintains the same logic flow while improving code readability by reducing nesting and using more idiomatic Rust error handling patterns.
@github-actions
Copy link

GNU testsuite comparison:

Skipping an intermittent issue tests/shuf/shuf-reservoir (passes in this run but fails in the 'main' branch)
Skipping an intermittent issue tests/sort/sort-stale-thread-mem (passes in this run but fails in the 'main' branch)
Skipping an intermittent issue tests/tail/inotify-dir-recreate (passes in this run but fails in the 'main' branch)
Congrats! The gnu test tests/basenc/bounded-memory is now passing!

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.

1 participant