提交 a7a6575c 编写于 作者: M michaelm

6773270: java.net.URI fails to escape \u0000

Summary: check for \u0000
Reviewed-by: alanb
上级 839c7bfd
......@@ -2491,6 +2491,8 @@ public final class URI
// Tell whether the given character is permitted by the given mask pair
private static boolean match(char c, long lowMask, long highMask) {
if (c == 0) // 0 doesn't have a slot in the mask. So, it never matches.
return false;
if (c < 64)
return ((1L << c) & lowMask) != 0;
if (c < 128)
......
......@@ -1091,6 +1091,7 @@ public class Test {
test("").p("").sp("").z();
header("Emptiness");
// Components that may be empty
......@@ -1321,6 +1322,11 @@ public class Test {
.sp("//host/foo%20bar/a/b/c/resolve").s("http")
.pd("/foo bar/a/b/c/resolve").h("host")
.p("/foo%20bar/a/b/c/resolve").z();
// 6773270: java.net.URI fails to escape u0000
test("s", "a", "/\u0000", null)
.s("s").p("/%00").h("a")
.ta("s://a/%00").z();
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册