Closed ma6174 closed 7 years ago
/cc @mpvl
Reproduces on linux/amd64 (x/net/idna master).
package idna
import (
"testing"
"golang.org/x/net/idna"
)
func TestToASCII(t *testing.T) {
idna.Lookup.ToASCII("\xed")
}
any updates here?
So this is an issue in the x/net/idna
master; setting the milestone to 1.10 since the faulty idna
version is also currently vendored in the 1.9 tree.
@ALTree Can I take a look this issue?
@corona10 sure! I'm not working on this.
Change https://golang.org/cl/73610 mentions this issue: idna: Fix ToASCII bug causes memory and cpu leak
@ALTree I submitted the patch PTAL!
Change https://golang.org/cl/73630 mentions this issue: idna: Fix ToASCII bug causes memory and cpu leak
Change https://golang.org/cl/73730 mentions this issue: idna: Fix functions can causes memory and cpu leak.
What version of Go are you using (
go version
)?go version go1.9.1 darwin/amd64
Does this issue reproduce with the latest release?
Yes
What operating system and processor architecture are you using (
go env
)?What did you do?
What did you expect to see?
program exit with an error of
no such host
orinvalid domain name
in go1.8
in go1.7 or before
What did you see instead?
program fataled until oom, and more than 100% cpu usage.
the problem code is:
https://github.com/golang/go/blob/release-branch.go1.9/src/vendor/golang_org/x/net/idna/tables.go#L484-L487
https://github.com/golang/go/blob/release-branch.go1.9/src/vendor/golang_org/x/net/idna/idna.go#L401-L404
https://github.com/golang/go/blob/release-branch.go1.9/src/vendor/golang_org/x/net/idna/idna.go#L423
len(s) == 1
andlookupString()
return0, 0
; invalidateAndMap
, sz=0, i+=0, i not changed, so the for loop cannot break, this is a cpu leak;v=0
hitselect unknown
branch, callb = append(b, "\ufffd"...)
, this is a memory leak.