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

x/net/http2: nil pointer dereference in Server.ServeConn when opts==nil #33839

Closed
ascheglov opened this issue Aug 26, 2019 · 1 comment
Closed

x/net/http2: nil pointer dereference in Server.ServeConn when opts==nil #33839

ascheglov opened this issue Aug 26, 2019 · 1 comment
Labels
Milestone

Comments

@ascheglov
Copy link

@ascheglov ascheglov commented Aug 26, 2019

The docs on Server.ServeConn say that "The opts parameter is optional. If nil, default values are used. "

However ServeConn calls serverConnBaseContext(c, opts), which calls opts.context(), which doesn't check its receiver for nil
https://github.com/golang/net/blob/74dc4d7220e7acc4e100824340f3e66577424772/http2/server.go#L325

func (o *ServeConnOpts) context() context.Context {
	if o.Context != nil {
...

It looks like it should do o != nil as its sister functions do.

@gopherbot

This comment has been minimized.

Copy link

@gopherbot gopherbot commented Aug 26, 2019

Change https://golang.org/cl/191857 mentions this issue: http2: correct ServeConnOpts.context's nil receiver check

@bcmills bcmills added the NeedsFix label Aug 26, 2019
@bcmills bcmills added this to the Go1.14 milestone Aug 26, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants
You can’t perform that action at this time.