aboutsummaryrefslogtreecommitdiffstats
path: root/rpc/api/eth_args.go
diff options
context:
space:
mode:
authorBas van Kervel <bas@ethdev.com>2015-10-29 15:40:07 +0800
committerBas van Kervel <bas@ethdev.com>2015-10-29 16:23:03 +0800
commitc3c5f8b654f9ddaeedeb2d3d5d1caf000e08320e (patch)
tree37a575308d81a95cc22c667841f82a7c4b083fd8 /rpc/api/eth_args.go
parent56f8699a6c6bfe613d2ab28c47631a1f4a29e36f (diff)
downloaddexon-c3c5f8b654f9ddaeedeb2d3d5d1caf000e08320e.tar
dexon-c3c5f8b654f9ddaeedeb2d3d5d1caf000e08320e.tar.gz
dexon-c3c5f8b654f9ddaeedeb2d3d5d1caf000e08320e.tar.bz2
dexon-c3c5f8b654f9ddaeedeb2d3d5d1caf000e08320e.tar.lz
dexon-c3c5f8b654f9ddaeedeb2d3d5d1caf000e08320e.tar.xz
dexon-c3c5f8b654f9ddaeedeb2d3d5d1caf000e08320e.tar.zst
dexon-c3c5f8b654f9ddaeedeb2d3d5d1caf000e08320e.zip
rpc: fixed params parsing problem which could lead to a panic
check argument type before parsing params recover from panic in ipc channel
Diffstat (limited to 'rpc/api/eth_args.go')
-rw-r--r--rpc/api/eth_args.go14
1 files changed, 11 insertions, 3 deletions
diff --git a/rpc/api/eth_args.go b/rpc/api/eth_args.go
index 6aca6a663..457350d74 100644
--- a/rpc/api/eth_args.go
+++ b/rpc/api/eth_args.go
@@ -626,7 +626,12 @@ func (args *GetBlockByHashArgs) UnmarshalJSON(b []byte) (err error) {
args.IncludeTxs = obj[1].(bool)
- return nil
+ if inclTx, ok := obj[1].(bool); ok {
+ args.IncludeTxs = inclTx
+ return nil
+ }
+
+ return shared.NewInvalidTypeError("includeTxs", "not a bool")
}
type GetBlockByNumberArgs struct {
@@ -648,9 +653,12 @@ func (args *GetBlockByNumberArgs) UnmarshalJSON(b []byte) (err error) {
return err
}
- args.IncludeTxs = obj[1].(bool)
+ if inclTx, ok := obj[1].(bool); ok {
+ args.IncludeTxs = inclTx
+ return nil
+ }
- return nil
+ return shared.NewInvalidTypeError("includeTxs", "not a bool")
}
type BlockFilterArgs struct {