`termlens render` and `diff` read their input without any size bound
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 84/100
Research direction
Start in termlens-cli/src/main.rs around lines 221–230, where file and stdin input use read_to_string. Check how input is parsed and how CLI errors set exit code 2, then add bounded reading and a clear error for oversized input. Verify both reported repros refuse quickly, including the requested test using a capped child process.
Written by the indexing model from the issue text.
Description
What happens. The CLI reads a whole file or stream into memory before parsing it:
( ulimit -v 300000; head -c 400000000 /dev/zero | termlens render --text - )
termlens: <stdin>: out of memory # exit 2, after reading ~300 MB
termlens render --text /dev/zero behaves the same. Without a memory cap, yes | termlens render --text - grows until the OOM killer runs. It was not run uncapped.
Why it matters. Since #583 a saved screen is bounded: at most 1000x1000 cells, plus styles. So the input has a natural ceiling well below what the CLI will try to hold.
Cause. termlens-cli/src/main.rs:221-230 uses read_to_string on the file or stdin.
Fix. Read through .take(LIMIT + 1) with a generous limit, for example 256 MiB, and refuse with exit 2 and a clear message when it is exceeded.
Done when both repros refuse quickly with a bounded allocation, with a test using a capped child.
- Dominant language
- Rust
- Stars
- 28
- Forks
- 24
- Avg merge
- 11h 23m
- Merged PRs (30d)
- 42
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from vyncint/termlens
-
documentation good first issue
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
Maintainers usually reply within 1 day
-
documentation good first issue
Difficulty 1/5 Under an hour Newbie friendliness 95/100
Maintainers usually reply within 1 day
-
Release notes show a broken link: `extract-changelog.sh` copies a reference but not its definitionOpenbug good first issue
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
Maintainers usually reply within 1 day
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 67/100
Maintainers usually reply within 1 day
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Maintainers usually reply within 1 day
All issues in vyncint/termlens
Similar issues
-
priority middle
Difficulty 1/5 Under an hour Newbie friendliness 62/100
KATO-Hiro/AtCoderClans#12940 ·
Maintainers usually reply within 1 day
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 83/100
Maintainers usually reply within 1 day
-
o8 next debug build aborts on Glass to Dark appearance switch (nil identifier messaged before check)Openbug
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
hurttlocker/o8#5112 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 79/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 1 day