`Psbt::sign` panics on `non_witness_utxo` with out-of-range vout (upstream fix pending in bitcoin 0.32.x)
Los mantenedores suelen responder en 2 días
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 3/5
- Tiempo estimado
- 1-2 días
- Aptitud para principiantes
- 68/100
- Tipo de issue
- Error
- Claridad
- Bastante claro
- Estado de actividad
- Activo
- Stack tecnológico
- rust
- Área
- cryptography
Línea de trabajo
Comienza con bitcoin-0.32.8/src/psbt/mod.rs alrededor de spend_utxo y los puntos de entrada Psbt::sign y sighash_ecdsa. Compara el fix upstream rust-bitcoin#5500 y decide si se debe hacer backport o actualizar la release de bitcoin. Se considera terminado cuando las entradas non_witness_utxo malformadas devuelven un error en lugar de provocar un panic, con una prueba de regresión que cubra un vout fuera de rango.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Describe the bug
bitcoin::Psbt::spend_utxo in the bitcoin 0.32.x line indexes non_witness_utxo.output[vout] without a bounds check, so Psbt::sign (and sighash_ecdsa) panic on a PSBT input whose non_witness_utxo has fewer outputs than previous_output.vout (e.g. a wrong or truncated previous transaction). This was fixed upstream on master in rust-bitcoin/rust-bitcoin#5500 (returns MissingSpendUtxo instead), but the fix is not in the 0.32.x branches as of 0.32.8.
Wallet::sign_with_signers is not affected, since it validates non_witness_utxo against the outpoint before signing. However, since #505 the recommended flow in docs and examples is to call bitcoin::Psbt::sign directly, which does reach the panic when given a malformed PSBT.
This issue tracks picking up the upstream fix (backport to 0.32.x or bump to a release that includes it).
This issue was found by AI.
To Reproduce
// psbt built by the wallet with a single wpkh input, then corrupted:
let mut psbt = builder.finish().unwrap();
psbt.inputs[0].witness_utxo = None;
psbt.inputs[0].non_witness_utxo = Some(Transaction {
version: transaction::Version::TWO,
lock_time: absolute::LockTime::ZERO,
input: vec![],
output: vec![], // no outputs
});
psbt.sign(&xpriv, wallet.secp_ctx()); // panics: index out of bounds at bitcoin-0.32.8/src/psbt/mod.rs:626
Expected behavior
Signing a PSBT with an inconsistent non_witness_utxo should return an error rather than panic.
Build environment
- BDK tag/commit:
6fc68462(master),bitcoin0.32.8
Which backend(s) are relevant (if any)?
- None / not backend-related (e.g.
bdk_chain,bdk_core)
Is this blocking production use?
- No
- Lenguaje dominante
- Rust
- Estrellas
- 61
- Forks
- 116
- Merge medio
- 7 h 29 min
- PR fusionados (30 d)
- 6
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 bitcoindevkit/bdk_wallet
-
Change output crossing a compactsize boundary leaves the fee slightly below the requested feeratePosiblemente ocupada @artofbitcoin la tomó hace 2 días. Abiertobug
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
bitcoindevkit/bdk_wallet#578 · 2 comentarios ·
Los mantenedores suelen responder en 2 días
-
Change address `mark_used` marker is not persisted; same change address reissued after restartPosiblemente ocupada @NaitikVerma6776 la tomó hace 2 días. Abiertobug
Dificultad 2/5 1-3 horas Aptitud para principiantes 84/100
bitcoindevkit/bdk_wallet#577 · 3 comentarios ·
Los mantenedores suelen responder en 2 días
-
bdk_wallet uses `std` items without feature gatePosiblemente ocupada @Chibey-max la tomó hace 6 días. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
bitcoindevkit/bdk_wallet#574 · 1 comentario ·
Los mantenedores suelen responder en 2 días
-
`CaravanExport::to_descriptors` accepts duplicate xpubsPosiblemente ocupada @chukwudiikeh la tomó hace 6 días. Abiertobug
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
bitcoindevkit/bdk_wallet#560 · 1 comentario ·
Los mantenedores suelen responder en 2 días
-
`PsbtUtils::fee_amount` panics when PSBT outputs exceed inputsPosiblemente ocupada @shubham5080 la tomó hace 29 días. Abiertobug
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
bitcoindevkit/bdk_wallet#558 · 1 comentario ·
Los mantenedores suelen responder en 2 días
Todos los issues de bitcoindevkit/bdk_wallet
Issues similares
-
agent:triaged bug bughunt pm:bundler priority:p1
Dificultad 2/5 1-3 horas Aptitud para principiantes 70/100
SocketDev/socket-patch#1573 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
rustix::termios::Termios::OutputModes does not expost some const e.g. OLCUC for musl and macOSAbierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 62/100
bytecodealliance/rustix#1706 · 1 comentario ·
Los mantenedores suelen responder en 11 días
-
`LazyFrameRemote` and `ExecuteRemote` sinks do not accept `Path`, like `LazyFrame` sinks do.Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 62/100
-
Bump anybuf version to ^1.0.0Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
wormhole-foundation/wormhole#5062 ·
Los mantenedores suelen responder en 1 día
-
LaunchOrFocusPlugin switches to the wrong tab after tabs are reordered (tab id used as position)Posiblemente ocupada @olegator888 la tomó hoy. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 74/100
zellij-org/zellij#5719 ·
Los mantenedores suelen responder en 1 día