swarm
swarm copied to clipboard
Segfault with invalid CLI parameters
A segfault is produced when invalid value of swap-deposit-amount is passed into cli
Example --swap-deposit-amount=0
INFO [02-13|16:40:05.529] bound to chequebook swaplog=* base=f34abaa1cc41db1a:656e6f64653a2f2f chequebookAddr=0xB5DD3f157e0737Be4eb1D16E53F957720F317a17
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x8 pc=0xd1f898]
goroutine 1 [running]:
github.com/ethersphere/swarm/uint256.(*Uint256).Value(...)
github.com/ethersphere/swarm@/uint256/uint256.go:52
github.com/ethersphere/swarm/swap.(*Swap).AvailableBalance(0xc0004705a0, 0xc00042b9e0, 0x10, 0x20)
github.com/ethersphere/swarm@/swap/api.go:82 +0x168
github.com/ethersphere/swarm/swap.(*Swap).promptDepositAmount(0xc0004705a0, 0xc0004553d8, 0x0, 0xc000000000)
github.com/ethersphere/swarm@/swap/swap.go:636 +0x40
github.com/ethersphere/swarm/swap.New(0xc0000f00f0, 0x46, 0xc00025eb70, 0x7fff55818041, 0x1b, 0xc00016b740, 0x0, 0x0, 0x0, 0x0, ...)
github.com/ethersphere/swarm@/swap/swap.go:223 +0xae4
github.com/ethersphere/swarm.NewSwarm(0xc00020a9c0, 0x0, 0x0, 0xbe, 0x22f7f20)
github.com/ethersphere/swarm@/swarm.go:142 +0x4b3
main.registerBzzService.func1(0xc0003fe9a0, 0xc00016b620, 0xc000455a28, 0xc0003fe800, 0x2)
github.com/ethersphere/swarm@/cmd/swarm/main.go:395 +0x56
github.com/ethereum/go-ethereum/node.(*Node).Start(0xc000204500, 0x0, 0x0)
github.com/ethereum/[email protected]/node/node.go:206 +0x408
github.com/ethereum/go-ethereum/cmd/utils.StartNode(0xc000204500)
github.com/ethereum/[email protected]/cmd/utils/cmd.go:67 +0x2f
main.bzzd(0xc0001d2b00, 0x0, 0x0)
github.com/ethersphere/swarm@/cmd/swarm/main.go:357 +0x36c
gopkg.in/urfave/cli%2ev1.HandleAction(0xf5ff80, 0x1205b70, 0xc0001d2b00, 0xc0001588a0, 0x0)
gopkg.in/urfave/[email protected]/app.go:490 +0xc8
gopkg.in/urfave/cli%2ev1.(*App).Run(0xc00020a000, 0xc0000320f0, 0xf, 0xf, 0x0, 0x0)
gopkg.in/urfave/[email protected]/app.go:264 +0x58c
main.main()
github.com/ethersphere/swarm@/cmd/swarm/main.go:271 +0x55