Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

contract extend panics on single-change resultMetaXdr (index out of bounds at extend.rs:306)

オープン 初心者向け
#2,796 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
1/5
見積もり時間
1時間未満
初心者へのやさしさ
90/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
rust
領域
cli

調査の方向性

cmd/soroban-cli/src/commands/contract/extend.rs:306 から始める。ここでは空チェック後に match が &changes[0] と &changes[1] をインデックスしている。これをスライスパターンに置き換える(あるいは restore.rs の parse_changes() を再利用する)ことで、変更が 1 件の meta が panic せずに Error::LedgerEntryNotFound を返すようにする。extend_nonexistent_entry_errors_without_panic を反映した、LedgerEntryChange が 1 件だけの result meta を持つリグレッションテストを追加し、extend のテストスイートを実行して index out of bounds が発生しないことを確認する。

索引モデルが issue の本文から書いたものです。

説明

stellar contract extend reports the new liveUntilLedgerSeq by reading getTransaction.resultMetaXdr and inspecting operations[0].changes. After guarding operations.is_empty() and changes.is_empty(), it does match (&changes[0], &changes[1]) at cmd/soroban-cli/src/commands/contract/extend.rs:306. A meta whose single operation carries exactly one LedgerEntryChange passes both guards and panics with index out of bounds: the len is 1 but the index is 1.

The panic happens in the result-reporting phase, after the transaction has already been signed and submitted, so the operator sees a crash instead of the new TTL even when the on-chain extend may have succeeded.

PR #2657 added the equivalent guard for the length-zero case (.first().ok_or(Error::LedgerEntryNotFound)?) but left the length-one arm at line 306 reachable.

Fix

Bound the match instead of indexing, reusing the existing error:

let [first, second] = &changes[..] else {
    return Err(Error::LedgerEntryNotFound);
};
match (first, second) {

Alternatively, reuse restore.rs's iterator-based parse_changes(), which handles all lengths without indexing. A regression test with a single-change meta (asserting no panic / no index out of bounds) should accompany the fix, mirroring extend_nonexistent_entry_errors_without_panic.

Notes

This was surfaced via a security report and triaged as a non-security robustness bug: the panic is a safe bounds-checked Rust abort reachable only from a hostile/compromised RPC endpoint, with no memory-safety, data-disclosure, or integrity impact (crash only, after submission).

主要言語
Rust
スター
128
フォーク
147
平均マージ
2日 12時間
マージ済み PR(30日)
35

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

stellar/stellar-cli のほかの issue

stellar/stellar-cli の issue をすべて見る

似ている issue

Rust の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。