Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(661)

Issue 6395055: code review 6395055: net: avoid nil pointer dereference when RemoteAddr.Stri... (Closed)

Can't Edit
Can't Publish+Mail
Start Review
Created:
11 years, 10 months ago by mikio
Modified:
11 years, 8 months ago
Reviewers:
rsc
CC:
dave_cheney.net, golang-dev
Visibility:
Public.

Description

net: avoid nil pointer dereference when RemoteAddr.String method chain is called Fixes issue 3721.

Patch Set 1 : diff -r 5e7fd762f356 https://code.google.com/p/go #

Total comments: 2

Patch Set 2 : diff -r 67fd7109c8ad https://code.google.com/p/go #

Patch Set 3 : diff -r 3019a3e15027 https://code.google.com/p/go #

Total comments: 3

Patch Set 4 : diff -r 2f39e6389d55 https://code.google.com/p/go #

Patch Set 5 : diff -r 64195dbf632d https://code.google.com/p/go #

Total comments: 4

Patch Set 6 : diff -r 4e3a1967af09 https://code.google.com/p/go #

Patch Set 7 : diff -r 66e0219bd117 https://code.google.com/p/go #

Total comments: 1

Patch Set 8 : diff -r 66e0219bd117 https://code.google.com/p/go #

Patch Set 9 : diff -r 1e84edee3397 https://code.google.com/p/go #

Patch Set 10 : diff -r 5972fe3f4418 https://code.google.com/p/go #

Total comments: 2
Unified diffs Side-by-side diffs Delta from patch set Stats (+133 lines, -31 lines) Patch
M src/pkg/net/fd.go View 1 2 3 4 5 6 7 8 1 chunk +2 lines, -3 lines 1 comment Download
M src/pkg/net/file.go View 1 2 3 4 5 6 7 8 3 chunks +6 lines, -8 lines 0 comments Download
M src/pkg/net/ipraw_test.go View 1 2 3 4 5 2 chunks +50 lines, -1 line 0 comments Download
M src/pkg/net/sock.go View 1 2 3 4 5 6 7 8 5 chunks +48 lines, -19 lines 1 comment Download
M src/pkg/net/udp_test.go View 1 2 3 4 5 1 chunk +27 lines, -0 lines 0 comments Download

Messages

Total messages: 19
mikio
Hello golang-dev@googlegroups.com (cc: golang-dev@googlegroups.com), I'd like you to review this change to https://code.google.com/p/go
11 years, 10 months ago (2012-07-17 11:36:34 UTC) #1
mikio
Hello golang-dev@googlegroups.com (cc: golang-dev@googlegroups.com), Please take another look.
11 years, 10 months ago (2012-07-19 11:12:52 UTC) #2
dave_cheney.net
Hi Mikio, Thank you for fixing this issue. I'm not keen on those empty sentinel ...
11 years, 10 months ago (2012-07-20 05:07:57 UTC) #3
mikio
Hello golang-dev@googlegroups.com, dave@cheney.net (cc: golang-dev@googlegroups.com), Please take another look.
11 years, 10 months ago (2012-07-22 13:46:46 UTC) #4
mikio
Thank your for your comments. I revised CL to focus on the issue related a ...
11 years, 10 months ago (2012-07-22 14:01:34 UTC) #5
mikio
Hello golang-dev@googlegroups.com, dave@cheney.net (cc: golang-dev@googlegroups.com), Please take another look.
11 years, 10 months ago (2012-07-23 09:41:11 UTC) #6
rsc
Thanks for looking into this. I think I helped someone else with this offline recently ...
11 years, 9 months ago (2012-07-30 01:23:43 UTC) #7
mikio
On 2012/07/30 01:23:43, rsc wrote: > Thanks for looking into this. I think I helped ...
11 years, 9 months ago (2012-08-07 14:18:47 UTC) #8
mikio
Hello dave@cheney.net, rsc@golang.org (cc: golang-dev@googlegroups.com), Please take another look.
11 years, 9 months ago (2012-08-07 14:19:14 UTC) #9
mikio
Hello dave@cheney.net, rsc@golang.org (cc: golang-dev@googlegroups.com), Please take another look.
11 years, 9 months ago (2012-08-12 04:38:57 UTC) #10
dave_cheney.net
Looks good to me, modulo the comment below. Thanks. http://codereview.appspot.com/6395055/diff/32001/src/pkg/net/sock.go File src/pkg/net/sock.go (right): http://codereview.appspot.com/6395055/diff/32001/src/pkg/net/sock.go#newcode99 src/pkg/net/sock.go:99: ...
11 years, 9 months ago (2012-08-12 05:58:17 UTC) #11
mikio
On Sun, Aug 12, 2012 at 2:58 PM, <dave@cheney.net> wrote: > You can use typed ...
11 years, 9 months ago (2012-08-12 06:22:32 UTC) #12
mikio
Hello dave@cheney.net, rsc@golang.org (cc: golang-dev@googlegroups.com), Please take another look.
11 years, 9 months ago (2012-08-12 06:49:08 UTC) #13
dave_cheney.net
LGTM. My only remaining comment would be to consider if it is possible to replace ...
11 years, 9 months ago (2012-08-12 06:52:09 UTC) #14
dave_cheney.net
ping ?
11 years, 9 months ago (2012-08-21 00:41:35 UTC) #15
mikio
Hello dave@cheney.net, rsc@golang.org (cc: golang-dev@googlegroups.com), Please take another look.
11 years, 9 months ago (2012-08-21 12:48:14 UTC) #16
dave_cheney.net
Thank you. I'm very happy with how this turned out.
11 years, 9 months ago (2012-08-21 13:00:04 UTC) #17
mikio
*** Submitted as http://code.google.com/p/go/source/detail?r=2518eee18c4f *** net: avoid nil pointer dereference when RemoteAddr.String method chain is ...
11 years, 9 months ago (2012-08-23 11:54:10 UTC) #18
rsc
11 years, 8 months ago (2012-08-31 11:09:52 UTC) #19
Sorry for the delayed review. I'm not sure about this.

http://codereview.appspot.com/6395055/diff/39001/src/pkg/net/fd.go
File src/pkg/net/fd.go (right):

http://codereview.appspot.com/6395055/diff/39001/src/pkg/net/fd.go#newcode618
src/pkg/net/fd.go:618: netfd.setAddr(localSockname(fd, toAddr), toAddr(rsa))
It may not matter, but a direct translation of the old code would have used
netfd, not fd, in the call to localSockname. netfd is the accepted connection,
while fd is the listener.

http://codereview.appspot.com/6395055/diff/39001/src/pkg/net/sock.go
File src/pkg/net/sock.go (right):

http://codereview.appspot.com/6395055/diff/39001/src/pkg/net/sock.go#newcode103
src/pkg/net/sock.go:103: return (*TCPAddr)(nil)
This is unusual. Normally we do not put typed nils inside interface values.
Instead we return interface nils instead. I understand that this may keep
.String() from crashing, but it doesn't help callers who expect a successful
.(*TCPAddr) to result in a real data structure.
Sign in to reply to this message.

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b