Investigate integer overflow and page size in `get_invoice_range`
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 3/5
- 見積もり時間
- 1〜2日
- 初心者へのやさしさ
- 65/100
調査の方向性
Start with get_invoice_range in contracts/invoice/src/lib.rs, where start_idx + len_val is computed on usize values converted from u32. Add tests in contracts/invoice/src/test.rs for len = 0, start past the length, start = u32::MAX, and a very large len, then switch to saturating arithmetic and cap the page size. Done when no input traps, the cap is documented in contracts/invoice/README.md, and fmt, clippy and tests pass. The 32-bit wasm behaviour still needs confirming on that target, which the host tests cannot show.
索引モデルが issue の本文から書いたものです。
説明
Difficulty: Intermediate
Problem
get_invoice_range computes (start_idx + len_val).min(...) on usize values converted from u32. On the 32-bit wasm target usize is 32 bits, and the release profile enables overflow-checks, so a large start plus len could trap instead of returning an empty page. Host tests run on a 64-bit target and cannot show this. There is also no maximum page size.
Why it matters
A public read function should never trap on valid-looking input, and unbounded pages can exceed resource limits.
Scope of work
Confirm the behaviour on the wasm target, switch to saturating arithmetic, add a documented maximum page size, and add tests for len = 0, start greater than the length, start = u32::MAX, and a very large len.
Expected outcome
get_invoice_range handles all inputs safely, and the behaviour is covered by tests.
Acceptance criteria
- No input traps; extreme inputs return an empty or capped page.
- A page-size cap is documented in the contract README.
- New tests pass;
cargo fmt --check, clippy and tests pass.
Relevant files
contracts/invoice/src/lib.rs,contracts/invoice/src/test.rs,contracts/invoice/README.md
Dependencies
Related to #55 and #27 (same file). No ABI change is required.
Maintainer discussion needed?
No (internal behaviour only).
- 主要言語
- TypeScript
- スター
- 0
- フォーク
- 4
- 平均マージ
- 54分
- マージ済み PR(30日)
- 6
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートなし
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
Yormee-103/PayLoop のほかの issue
-
Add a CHANGELOG and release-notes convention対応中かも @Sharon-dev-create が今日担当しました。 オープンdifficulty: beginner documentation dx help wanted Stellar Wave
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
Yormee-103/PayLoop#169 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
Glossary of Stellar and PayLoop terms, linked from the Help page対応中かも @Yemmy88 が今日担当しました。 オープンdifficulty: beginner documentation good first issue help wanted Stellar Wave
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
Yormee-103/PayLoop#168 · コメント 3 件 ·
メンテナーはふだん 1 日以内に返信
-
difficulty: beginner dx good first issue help wanted web
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
Yormee-103/PayLoop#158 ·
メンテナーはふだん 1 日以内に返信
-
difficulty: beginner documentation good first issue help wanted security
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
Yormee-103/PayLoop#145 ·
メンテナーはふだん 1 日以内に返信
-
a11y difficulty: beginner good first issue help wanted web
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
Yormee-103/PayLoop#144 ·
メンテナーはふだん 1 日以内に返信
Yormee-103/PayLoop の issue をすべて見る
似ている issue
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
メンテナーはふだん 1 日以内に返信
-
agent-canvas bug oh-gpt-fleet priority:medium ready-for-dev UI/UX
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
メンテナーはふだん 1 日以内に返信
-
good first issue javascript test
難易度 2/5 1〜3時間 初心者へのやさしさ 85/100
メンテナーはふだん 2 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
writerslogic/scrivener-mcp#272 ·
メンテナーはふだん 1 日以内に返信
-
bug triaged tui ux wontfix
難易度 2/5 半日 初心者へのやさしさ 70/100
メンテナーはふだん 1 日以内に返信