`termlens render` and `diff` read their input without any size bound
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 2/5
- 見積もり時間
- 1〜3時間
- 初心者へのやさしさ
- 84/100
調査の方向性
ファイル入力とstdin入力でread_to_stringを使っているtermlens-cli/src/main.rsの221〜230行あたりから始めてください。入力の解析方法と、CLIエラーが終了コード2を設定する方法を確認し、そのうえで読み取りに上限を設け、入力が大きすぎる場合に明確なエラーを返すようにしてください。報告された両方の再現ケースがすぐに拒否されることを確認してください。上限を設けた子プロセスを使うよう求められたテストも含みます。
索引モデルが issue の本文から書いたものです。
説明
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.
- 主要言語
- Rust
- スター
- 28
- フォーク
- 24
- 平均マージ
- 11時間 23分
- マージ済み PR(30日)
- 42
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
vyncint/termlens のほかの issue
-
documentation good first issue
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
メンテナーはふだん 1 日以内に返信
-
documentation good first issue
難易度 1/5 1時間未満 初心者へのやさしさ 95/100
メンテナーはふだん 1 日以内に返信
-
Release notes show a broken link: `extract-changelog.sh` copies a reference but not its definitionオープンbug good first issue
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
メンテナーはふだん 1 日以内に返信
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 67/100
メンテナーはふだん 1 日以内に返信
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
メンテナーはふだん 1 日以内に返信
vyncint/termlens の issue をすべて見る
似ている issue
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100
dekobon/big-code-analysis#1729 ·
メンテナーはふだん 1 日以内に返信
-
bug help wanted
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
メンテナーはふだん 3 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
akitaonrails/ai-memory#1888 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
peteonrails/voxtype#941 ·
メンテナーはふだん 4 日以内に返信
-
bug priority:medium triage:maintainable
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
ccusage/ccusage#2000 · コメント 3 件 ·
メンテナーはふだん 1 日以内に返信