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
Labels
FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done.
Milestone

Comments

@ascheglov
Copy link

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
Copy link

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

@bcmills bcmills added the NeedsFix The path to resolution is known, but the work has not been done. label Aug 26, 2019
@bcmills bcmills added this to the Go1.14 milestone Aug 26, 2019
@golang golang locked and limited conversation to collaborators Aug 26, 2020
dteh pushed a commit to dteh/fhttp that referenced this issue Jun 22, 2022
Fixes golang/go#33839

Change-Id: Ic1a9e42afc8efda7ec2d39e705efe41474237d82
Reviewed-on: https://go-review.googlesource.com/c/net/+/191857
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done.
Projects
None yet
Development

No branches or pull requests

3 participants