contract extend panics on single-change resultMetaXdr (index out of bounds at extend.rs:306)
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 1/5
- Tempo stimato
- Meno di un'ora
- Idoneità per principianti
- 90/100
Direzione di ricerca
Parti da cmd/soroban-cli/src/commands/contract/extend.rs:306, dove il match indicizza &changes[0] e &changes[1] dopo le guardie di vuoto; sostituiscilo con un pattern di slice (o riutilizza parse_changes() da restore.rs) in modo che un meta con una singola modifica restituisca Error::LedgerEntryNotFound invece di andare in panic. Aggiungi un test di regressione con un result meta con una sola LedgerEntryChange, che rispecchi extend_nonexistent_entry_errors_without_panic, ed esegui la suite di test extend per confermare che non ci sia alcun index out of bounds.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
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).
- Lingua principale
- Rust
- Stelle
- 128
- Fork
- 147
- Merge medio
- 2g 12h
- PR unite (30g)
- 35
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Ha un modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di stellar/stellar-cli
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
stellar/stellar-cli#2806 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 1/5 1-3 ore Idoneità per principianti 85/100
stellar/stellar-cli#2781 ·
I maintainer di solito rispondono entro 1 giorno
-
Display the full authorization tree before signing auth entriesForse già presa @DeadZen l’ha presa 16 giorni fa. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
stellar/stellar-cli#2779 ·
I maintainer di solito rispondono entro 1 giorno
-
`tx update sequence-number next` fails when the transaction source is a muxed accountForse di nuovo libera Una pull request per questa issue è stata chiusa senza essere unita. Apertabug
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
stellar/stellar-cli#2774 ·
I maintainer di solito rispondono entro 1 giorno
-
`tx edit` fails on transaction XDR that is wrapped across multiple linesForse già presa Una pull request collegata a questa issue è aperta o già unita. Apertabug
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
stellar/stellar-cli#2773 ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di stellar/stellar-cli
Issue simili
-
BASEPRI needs an ISBAperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 69/100
rust-embedded/cortex-m#702 · 1 commento ·
-
Make major, minor, and makedev safe on solarish targetsForse già presa @xtqqczze l’ha presa oggi. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
I maintainer di solito rispondono entro 1 giorno
-
improvement/feedback improvement/workflow-project
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
higress-group/HiRoute#166 ·
I maintainer di solito rispondono entro 1 giorno
-
Proxy ignores l5d-retry-http and l5d-retry-grpc conditions that follow a comma and spaceForse già presa @RaphaelFakhri l’ha presa oggi. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 83/100
I maintainer di solito rispondono entro 3 giorni
-
sncast panics when decoding a `u384` valueForse già presa @RaphaelFakhri l’ha presa oggi. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
foundry-rs/starknet-foundry#4635 ·
I maintainer di solito rispondono entro 3 giorni