net: call net.ResolveIPAddr with nul char causes a panic in the goroutine on Windows build #31597
Labels
Milestone
Comments
In lookupIP, it seems like it is not good to call Deprecated syscall.StringToUTF16Ptr which causes panic. lookupIP: Line 99 in 68d4b12 syscall.StringToUTF16Ptr: go/src/syscall/syscall_windows.go Lines 65 to 66 in 68d4b12 go/src/syscall/syscall_windows.go Lines 27 to 33 in 68d4b12 |
Change https://golang.org/cl/173362 mentions this issue: |
Change https://golang.org/cl/217729 mentions this issue: |
gopherbot
pushed a commit
that referenced
this issue
Feb 5, 2020
net.LookupHost("foo\x00bar") may resolve successfully on some networks. Reduce the scope of the test to check only that the call doesn't panic. Also update the test comment to reference the relevant issue. Fixes #37031 Updates #31597 Change-Id: If175deed8121625ef507598c6145e937ccffd89e Reviewed-on: https://go-review.googlesource.com/c/go/+/217729 Reviewed-by: Ian Lance Taylor <iant@golang.org> Run-TryBot: Dmitri Shuralyov <dmitshur@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
What did you do?
My product's server crashed and reproduced the problem from the panic log.
The reproduction program is below.
https://play.golang.org/p/1FdRbei_83s
The reproduction program does not work on Go Playground. Create a windows build and run it.
What did you expect to see?
I wanted to return an error if an invalid string is passed.
What did you see instead?
Output of Windows build binary (
GOOS=windows go run resolve_ip.go
)Output of Linux build binary (
go run resolve_ip.go
)System details
The text was updated successfully, but these errors were encountered: