Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
G
Geth-Modification
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
张蕾
Geth-Modification
Commits
fd27f074
Commit
fd27f074
authored
9 years ago
by
Jeffrey Wilcke
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1945 from bas-vk/rpcparsing
Argument parsing can lead to panic in rpc channel
parents
8202bae0
c3c5f8b6
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
7 deletions
+18
-7
eth_args.go
rpc/api/eth_args.go
+11
-3
comms.go
rpc/comms/comms.go
+7
-4
No files found.
rpc/api/eth_args.go
View file @
fd27f074
...
...
@@ -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
{
...
...
This diff is collapsed.
Click to expand it.
rpc/comms/comms.go
View file @
fd27f074
...
...
@@ -62,13 +62,18 @@ type EthereumClient interface {
func
handle
(
id
int
,
conn
net
.
Conn
,
api
shared
.
EthereumApi
,
c
codec
.
Codec
)
{
codec
:=
c
.
New
(
conn
)
defer
func
()
{
if
r
:=
recover
();
r
!=
nil
{
glog
.
Errorf
(
"panic: %v
\n
"
,
r
)
}
codec
.
Close
()
}()
for
{
requests
,
isBatch
,
err
:=
codec
.
ReadRequest
()
if
err
==
io
.
EOF
{
codec
.
Close
()
return
}
else
if
err
!=
nil
{
codec
.
Close
()
glog
.
V
(
logger
.
Debug
)
.
Infof
(
"Closed IPC Conn %06d recv err - %v
\n
"
,
id
,
err
)
return
}
...
...
@@ -87,7 +92,6 @@ func handle(id int, conn net.Conn, api shared.EthereumApi, c codec.Codec) {
err
=
codec
.
WriteResponse
(
responses
[
:
responseCount
])
if
err
!=
nil
{
codec
.
Close
()
glog
.
V
(
logger
.
Debug
)
.
Infof
(
"Closed IPC Conn %06d send err - %v
\n
"
,
id
,
err
)
return
}
...
...
@@ -98,7 +102,6 @@ func handle(id int, conn net.Conn, api shared.EthereumApi, c codec.Codec) {
rpcResponse
=
shared
.
NewRpcResponse
(
requests
[
0
]
.
Id
,
requests
[
0
]
.
Jsonrpc
,
res
,
err
)
err
=
codec
.
WriteResponse
(
rpcResponse
)
if
err
!=
nil
{
codec
.
Close
()
glog
.
V
(
logger
.
Debug
)
.
Infof
(
"Closed IPC Conn %06d send err - %v
\n
"
,
id
,
err
)
return
}
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment