Avoid rune overflow when converting to unicode
This commit is contained in:
parent
e220dd92fd
commit
7ed808b59f
|
@ -254,6 +254,10 @@ func decode(b []byte) []byte {
|
||||||
return src
|
return src
|
||||||
}
|
}
|
||||||
i += digit * w
|
i += digit * w
|
||||||
|
if i < 0 {
|
||||||
|
// safety check for rune overflow
|
||||||
|
return src
|
||||||
|
}
|
||||||
|
|
||||||
t = tfunc(k, bias)
|
t = tfunc(k, bias)
|
||||||
if digit < t {
|
if digit < t {
|
||||||
|
|
|
@ -86,7 +86,7 @@ var invalidACEs = []string{
|
||||||
"xn--*",
|
"xn--*",
|
||||||
"xn--",
|
"xn--",
|
||||||
"xn---",
|
"xn---",
|
||||||
//"xn--a000000000", // crashes IDN. TODO(miek): Fix.
|
"xn--a000000000",
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestInvalidPunycode(t *testing.T) {
|
func TestInvalidPunycode(t *testing.T) {
|
||||||
|
|
Loading…
Reference in New Issue