From 8a741db7595e85468d5cf551f9beb9f713c12248 Mon Sep 17 00:00:00 2001 From: David Hill Date: Mon, 1 Jun 2026 13:38:25 +0000 Subject: [PATCH] mixing: add missing bounds check --- wallet/mixing.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/wallet/mixing.go b/wallet/mixing.go index c74cdf0d7..fb78def89 100644 --- a/wallet/mixing.go +++ b/wallet/mixing.go @@ -6,6 +6,7 @@ package wallet import ( "context" + "fmt" "sync/atomic" "decred.org/dcrwallet/v5/errors" @@ -292,6 +293,10 @@ func (w *Wallet) MixOutput(ctx context.Context, output *wire.OutPoint, changeAcc if err != nil { return err } + if output.Index >= uint32(len(txDetails.MsgTx.TxOut)) { + return fmt.Errorf("index out of range: index:%d txouts:%d", + output.Index, len(txDetails.MsgTx.TxOut)) + } out := txDetails.MsgTx.TxOut[output.Index] prevScript = out.PkScript prevScriptVersion = out.Version