dusk-network / dusk-blockchain

Reference implementation of the DUSK Network node, written in Golang
MIT License
102 stars 47 forks source link

Panic while deserializing transaction #1529

Closed herr-seppia closed 1 year ago

herr-seppia commented 1 year ago

Describe the bug When a malformed transaction is received, dusk-blockchain will panic while calculating hash

To Reproduce Send a piecrust transaction to a local cluster

Expected behaviour If the transaction is impossible to handle, it should be just discarded

Logs/Screenshot

panic: runtime error: makeslice: len out of range

goroutine 9491348 [running]:
github.com/dusk-network/dusk-blockchain/pkg/core/data/ipc/transactions.UnmarshalTransactionPayloadDecoded(0xc001f02300, 0xc00112ae80, 0x3270d0)
        /home/runner/work/dusk-deployer/dusk-deployer/dusk-blockchain/pkg/core/data/ipc/transactions/payload_decoded.go:137 +0x65
github.com/dusk-network/dusk-blockchain/pkg/core/data/ipc/transactions.Transaction.Decode({0x1, 0x1, 0xc000d7d4d0, {0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, ...}, ...})
        /home/runner/work/dusk-deployer/dusk-deployer/dusk-blockchain/pkg/core/data/ipc/transactions/transaction.go:254 +0x228
github.com/dusk-network/dusk-blockchain/pkg/core/data/ipc/transactions.UnmarshalTransaction(0xe23440, 0xc001b27680)
        /home/runner/work/dusk-deployer/dusk-deployer/dusk-blockchain/pkg/core/data/ipc/transactions/transaction.go:146 +0xf3
github.com/dusk-network/dusk-blockchain/pkg/core/data/ipc/transactions.Unmarshal(0x9587ad, {0x1045758, 0xc001b27680})
        /home/runner/work/dusk-deployer/dusk-deployer/dusk-blockchain/pkg/core/data/ipc/transactions/transaction.go:193 +0x45
github.com/dusk-network/dusk-blockchain/pkg/p2p/wire/message.UnmarshalTxMessage(0x101e1a0, {0x1042c10, 0xc001f02240})
        /home/runner/work/dusk-deployer/dusk-deployer/dusk-blockchain/pkg/p2p/wire/message/transactions.go:18 +0xa7
github.com/dusk-network/dusk-blockchain/pkg/p2p/wire/message.Unmarshal(0xc001f02210, 0xc001109ac0)
        /home/runner/work/dusk-deployer/dusk-deployer/dusk-blockchain/pkg/p2p/wire/message/message.go:252 +0x2ca
github.com/dusk-network/dusk-blockchain/pkg/p2p/peer.(*MessageProcessor).Collect(0xc00031e320, {0xc001cfe630, 0xb}, {0xc001947c04, 0x699, 0x699}, 0xa, 0x30, 0xebc420)
        /home/runner/work/dusk-deployer/dusk-deployer/dusk-blockchain/pkg/p2p/peer/processor.go:61 +0x265
github.com/dusk-network/dusk-blockchain/pkg/p2p/kadcast.(*Reader).processMessage(0xc0001fbf80, 0xc000ba3590)
        /home/runner/work/dusk-deployer/dusk-deployer/dusk-blockchain/pkg/p2p/kadcast/reader.go:106 +0x3d7
created by github.com/dusk-network/dusk-blockchain/pkg/p2p/kadcast.(*Reader).Listen.func1
        /home/runner/work/dusk-deployer/dusk-deployer/dusk-blockchain/pkg/p2p/kadcast/reader.go:71 +0x3f