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

net: nil pointer deref #4033

Closed
dvyukov opened this issue Sep 1, 2012 · 5 comments

Comments

Projects
None yet
5 participants
@dvyukov
Copy link
Member

commented Sep 1, 2012

parent: 13989:79225d9f3ced tip
linux/amd64

$ go test net

=== RUN TestDialTimeout
panic: runtime error: invalid memory address or nil pointer dereference
[signal 0xb code=0x1 addr=0x10 pc=0x44be96]

goroutine 0xf8400422a0 [running]:
net.selfConnect(0xf84003a200, 0x0, 0x0, 0x0, 0xf8400010f0, ...)
    /usr/local/google/home/dvyukov/go_select/src/pkg/net/tcpsock_posix.go:208 +0xa6
net.DialTCP(0x58343c, 0xf800000003, 0x0, 0xf84000b420, 0x56f201, ...)
    /usr/local/google/home/dvyukov/go_select/src/pkg/net/tcpsock_posix.go:176 +0x261
net.dialAddr(0x58343c, 0x70637400000003, 0xf840019ca0, 0xf, 0xf84001a6f0, ...)
    /usr/local/google/home/dvyukov/go_select/src/pkg/net/dial.go:102 +0x20f
net.func·015(0xf840019cb0, 0xf840019cc0, 0xf840000238, 0xf840000240, 0x0, ...)
    /usr/local/google/home/dvyukov/go_select/src/pkg/net/dial.go:140 +0x177
created by net.DialTimeout
    /usr/local/google/home/dvyukov/go_select/src/pkg/net/dial.go:142 +0x17c
@rsc

This comment has been minimized.

Copy link
Contributor

commented Sep 1, 2012

Comment 1:

I'm pretty sure there's a pending CL for this bug.
@dvyukov

This comment has been minimized.

Copy link
Member Author

commented Sep 1, 2012

Comment 2:

OK
I happens here:
func remoteSockname(fd *netFD, toAddr func(syscall.Sockaddr) Addr) Addr {
        sa, _ := syscall.Getpeername(fd.sysfd)
        if sa == nil {
                return nullProtocolAddr(fd.family, fd.sotype)
        }
        return toAddr(sa)
}
when syscall.Getpeername() returns nil with errno=ENOTCONN, nullProtocolAddr() return
(*TCPAddr)(nil) that is later dereferenced in selfConnect().

Owner changed to ---.

Status changed to New.

@davecheney

This comment has been minimized.

Copy link
Contributor

commented Sep 2, 2012

Comment 3:

This is CL http://golang.org/cl/6479053/

Labels changed: added priority-soon, removed priority-triage.

Owner changed to @mikioh.

Status changed to Accepted.

@rsc

This comment has been minimized.

Copy link
Contributor

commented Sep 12, 2012

Comment 4:

Labels changed: added go1.1.

@mikioh

This comment has been minimized.

Copy link
Contributor

commented Sep 18, 2012

Comment 5:

The root cause of this issue, a fragile fix for the issue #3721, is reverted.

Status changed to Retracted.

@rsc rsc added this to the Go1.1 milestone Apr 14, 2015

@rsc rsc removed the go1.1 label Apr 14, 2015

@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.
You can’t perform that action at this time.