contract extend panics on single-change resultMetaXdr (index out of bounds at extend.rs:306)
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
調査の方向性
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
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
stellar/stellar-cli のほかの issue
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
stellar/stellar-cli#2806 ·
メンテナーはふだん 1 日以内に返信
-
難易度 1/5 1〜3時間 初心者へのやさしさ 85/100
stellar/stellar-cli#2781 ·
メンテナーはふだん 1 日以内に返信
-
Display the full authorization tree before signing auth entries対応中かも @DeadZen が 15 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
stellar/stellar-cli#2779 ·
メンテナーはふだん 1 日以内に返信
-
`tx update sequence-number next` fails when the transaction source is a muxed account再び着手できるかも このイシューのプルリクエストはマージされずにクローズされました。 オープンbug
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
stellar/stellar-cli#2774 ·
メンテナーはふだん 1 日以内に返信
-
`tx edit` fails on transaction XDR that is wrapped across multiple lines再び着手できるかも このイシューのプルリクエストはマージされずにクローズされました。 オープンbug
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
stellar/stellar-cli#2773 ·
メンテナーはふだん 1 日以内に返信
stellar/stellar-cli の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
メンテナーはふだん 1 日以内に返信
-
難易度 1/5 1時間未満 初心者へのやさしさ 82/100
521xueweihan/HelloGitHub#4023 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
cloudflare/pingora#1055 ·
メンテナーはふだん 1 日以内に返信
-
enhancement
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
メンテナーはふだん 1 日以内に返信