summaryrefslogtreecommitdiffstats
path: root/vendor/golang.org/x/text/internal/export/idna
diff options
context:
space:
mode:
authorChristopher Speller <crspeller@gmail.com>2017-11-13 09:09:58 -0800
committerGitHub <noreply@github.com>2017-11-13 09:09:58 -0800
commit1329aa51b605cb54ba9aae3a82a0a87b881fb7b3 (patch)
tree93cbf354ab894a560fc2cef8ef685d681b4ff889 /vendor/golang.org/x/text/internal/export/idna
parent7304a61ef597970be3031b14e652fb3a4df44304 (diff)
downloadchat-1329aa51b605cb54ba9aae3a82a0a87b881fb7b3.tar.gz
chat-1329aa51b605cb54ba9aae3a82a0a87b881fb7b3.tar.bz2
chat-1329aa51b605cb54ba9aae3a82a0a87b881fb7b3.zip
Updating server dependancies. (#7816)
Diffstat (limited to 'vendor/golang.org/x/text/internal/export/idna')
-rw-r--r--vendor/golang.org/x/text/internal/export/idna/idna.go17
-rw-r--r--vendor/golang.org/x/text/internal/export/idna/idna_test.go1
2 files changed, 17 insertions, 1 deletions
diff --git a/vendor/golang.org/x/text/internal/export/idna/idna.go b/vendor/golang.org/x/text/internal/export/idna/idna.go
index 9feea643e..e653c3367 100644
--- a/vendor/golang.org/x/text/internal/export/idna/idna.go
+++ b/vendor/golang.org/x/text/internal/export/idna/idna.go
@@ -309,7 +309,7 @@ func (p *Profile) process(s string, toASCII bool) (string, error) {
for ; len(s) > 0 && s[0] == '.'; s = s[1:] {
}
}
- // TODO: allow for a quick check the tables data.
+ // TODO: allow for a quick check of the tables data.
// It seems like we should only create this error on ToASCII, but the
// UTS 46 conformance tests suggests we should always check this.
if err == nil && p.verifyDNSLength && s == "" {
@@ -405,6 +405,9 @@ func validateRegistration(p *Profile, s string) (idem string, bidi bool, err err
}
for i := 0; i < len(s); {
v, sz := trie.lookupString(s[i:])
+ if sz == 0 {
+ return s, bidi, runeError(utf8.RuneError)
+ }
bidi = bidi || info(v).isBidi(s[i:])
// Copy bytes not copied so far.
switch p.simplify(info(v).category()) {
@@ -446,6 +449,15 @@ func validateAndMap(p *Profile, s string) (vm string, bidi bool, err error) {
var combinedInfoBits info
for i := 0; i < len(s); {
v, sz := trie.lookupString(s[i:])
+ if sz == 0 {
+ b = append(b, s[k:i]...)
+ b = append(b, "\ufffd"...)
+ k = len(s)
+ if err == nil {
+ err = runeError(utf8.RuneError)
+ }
+ break
+ }
combinedInfoBits |= info(v)
bidi = bidi || info(v).isBidi(s[i:])
start := i
@@ -584,6 +596,9 @@ func validateFromPunycode(p *Profile, s string) error {
// loop.
for i := 0; i < len(s); {
v, sz := trie.lookupString(s[i:])
+ if sz == 0 {
+ return runeError(utf8.RuneError)
+ }
if c := p.simplify(info(v).category()); c != valid && c != deviation {
return &labelError{s, "V6"}
}
diff --git a/vendor/golang.org/x/text/internal/export/idna/idna_test.go b/vendor/golang.org/x/text/internal/export/idna/idna_test.go
index fed6e2ee7..ff878e5b2 100644
--- a/vendor/golang.org/x/text/internal/export/idna/idna_test.go
+++ b/vendor/golang.org/x/text/internal/export/idna/idna_test.go
@@ -167,6 +167,7 @@ func TestLabelErrors(t *testing.T) {
{resolve, "\u3002b", ".b", ""},
{resolve, "..b", "..b", ""},
{resolve, "b..", "b..", ""},
+ {resolve, "\xed", "", "P1"},
// Raw punycode
{punyA, "", "", ""},