Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

jsonrpc crashes if "params" is missing from the request #3848

Closed
gopherbot opened this issue Jul 21, 2012 · 2 comments
Closed

jsonrpc crashes if "params" is missing from the request #3848

gopherbot opened this issue Jul 21, 2012 · 2 comments

Comments

@gopherbot
Copy link
Contributor

by alexandru@mosoi.ro:

What steps will reproduce the problem?
If possible, include a link to a program on play.golang.org.
1. Download program at:
http://play.golang.org/p/6GOV397bC9

2. Run it:
go run a.go

3. Send an invalid request:
(printf '{"id":"spameggs","method":"Foo.Bar"}';
cat /dev/stdin) | nc localhost 1234

What is the expected output?
No crash, error returned.


What do you see instead?
Crash.
goroutine 4 [running]:
net/rpc/jsonrpc.(*serverCodec).ReadRequestBody(0xf8400ca000, 0x547330, 0xf84006fc40,
0x547330, 0xf84006fc40, ...)
    /usr/lib/go/src/pkg/net/rpc/jsonrpc/server.go:97 +0x89
net/rpc.(*Server).readRequest(0xf8400b40f0, 0xf8400b1800, 0xf8400ca000, 0xf8400b1080,
0xf8400a7300, ...)
    /usr/lib/go/src/pkg/net/rpc/server.go:507 +0x23b
net/rpc.(*Server).ServeCodec(0xf8400b40f0, 0xf8400b1800, 0xf8400ca000, 0x44026b)
    /usr/lib/go/src/pkg/net/rpc/server.go:407 +0x69
net/rpc.ServeCodec(0xf8400b1800, 0xf8400ca000)
    /usr/lib/go/src/pkg/net/rpc/server.go:604 +0x3e
net/rpc/jsonrpc.ServeConn(0xf8400b14c0, 0xf8400854c8)
    /usr/lib/go/src/pkg/net/rpc/jsonrpc/server.go:135 +0x4b
created by main.main
    /home/brtzsnr/source/a.go:21 +0xd8



Which compiler are you using (5g, 6g, 8g, gccgo)?
6g


Which operating system are you using?
Ubuntu 12.04 LTS

Which version are you using?  (run 'go version')
go version go1
@rsc
Copy link
Contributor

rsc commented Aug 31, 2012

Comment 1:

This issue was closed by revision 3efc482.

Status changed to Fixed.

@rsc
Copy link
Contributor

rsc commented Feb 5, 2013

Comment 2:

Issue #4761 has been merged into this issue.

@golang golang locked and limited conversation to collaborators Jun 24, 2016
This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants