contract extend panics on single-change resultMetaXdr (index out of bounds at extend.rs:306)
Los mantenedores suelen responder en 1 día
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 1/5
- Tiempo estimado
- Menos de una hora
- Aptitud para principiantes
- 90/100
Línea de trabajo
Empieza en cmd/soroban-cli/src/commands/contract/extend.rs:306, donde el match indexa &changes[0] y &changes[1] después de las comprobaciones de vacío; reemplázalo por un patrón de slice (o reutiliza parse_changes() de restore.rs) para que un meta con un único cambio devuelva Error::LedgerEntryNotFound en lugar de entrar en pánico. Añade una prueba de regresión con un result meta de una sola LedgerEntryChange, reflejando extend_nonexistent_entry_errors_without_panic, y ejecuta la suite de tests de extend para confirmar que no hay ningún index out of bounds.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
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).
- Lenguaje dominante
- Rust
- Estrellas
- 128
- Forks
- 147
- Merge medio
- 2 d 12 h
- PR fusionados (30 d)
- 35
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Tiene una plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de stellar/stellar-cli
-
bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
stellar/stellar-cli#2806 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 1/5 1-3 horas Aptitud para principiantes 85/100
stellar/stellar-cli#2781 ·
Los mantenedores suelen responder en 1 día
-
Display the full authorization tree before signing auth entriesPosiblemente ocupada @DeadZen la tomó hace 17 días. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
stellar/stellar-cli#2779 ·
Los mantenedores suelen responder en 1 día
-
`tx update sequence-number next` fails when the transaction source is a muxed accountQuizá libre de nuevo Un pull request para esta issue se cerró sin fusionarse. Abiertobug
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
stellar/stellar-cli#2774 ·
Los mantenedores suelen responder en 1 día
-
`tx edit` fails on transaction XDR that is wrapped across multiple linesPosiblemente ocupada @mangod12 la tomó hace 2 días. Abiertobug
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
stellar/stellar-cli#2773 ·
Los mantenedores suelen responder en 1 día
Todos los issues de stellar/stellar-cli
Issues similares
-
meta.json, text.txt and try JSON are written non-atomicallyPosiblemente ocupada @qwertymuzaffar la tomó hoy. Abiertobug
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
qwertymuzaffar/parrot#47 ·
Los mantenedores suelen responder en 1 día
-
Alt select PhotocraftAbiertopriority: medium
Dificultad 2/5 1-3 horas Aptitud para principiantes 66/100
storytold/photocraft#8041 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
fmt -p: an unprefixed last line without a newline gets one addedPosiblemente ocupada @fixfon la tomó hoy. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
jhspetersson/fselect#187 ·
-
documentation good first issue
Dificultad 2/5 1-3 horas Aptitud para principiantes 84/100
writerslogic/holographic-memory#96 ·
Los mantenedores suelen responder en 1 día