Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_jdk
提交
6cfe48a5
D
dragonwell8_jdk
项目概览
openanolis
/
dragonwell8_jdk
通知
4
Star
2
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
D
dragonwell8_jdk
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
6cfe48a5
编写于
4月 16, 2014
作者:
M
mullan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
8038184: XMLSignature throws StringIndexOutOfBoundsException if ID attribute value is empty String
Reviewed-by: xuelei
上级
6193af7a
变更
2
显示空白变更内容
内联
并排
Showing
2 changed file
with
29 addition
and
4 deletion
+29
-4
src/share/classes/com/sun/org/apache/xml/internal/security/utils/XMLUtils.java
.../sun/org/apache/xml/internal/security/utils/XMLUtils.java
+2
-2
test/javax/xml/crypto/dsig/GenerationTests.java
test/javax/xml/crypto/dsig/GenerationTests.java
+27
-2
未找到文件。
src/share/classes/com/sun/org/apache/xml/internal/security/utils/XMLUtils.java
浏览文件 @
6cfe48a5
...
@@ -934,7 +934,7 @@ public class XMLUtils {
...
@@ -934,7 +934,7 @@ public class XMLUtils {
Element
foundElement
=
null
;
Element
foundElement
=
null
;
String
id
=
value
.
trim
();
String
id
=
value
.
trim
();
if
(
id
.
charAt
(
0
)
==
'#'
)
{
if
(
!
id
.
isEmpty
()
&&
id
.
charAt
(
0
)
==
'#'
)
{
id
=
id
.
substring
(
1
);
id
=
id
.
substring
(
1
);
}
}
...
@@ -994,7 +994,7 @@ public class XMLUtils {
...
@@ -994,7 +994,7 @@ public class XMLUtils {
Node
processedNode
=
null
;
Node
processedNode
=
null
;
String
id
=
value
.
trim
();
String
id
=
value
.
trim
();
if
(
id
.
charAt
(
0
)
==
'#'
)
{
if
(
!
id
.
isEmpty
()
&&
id
.
charAt
(
0
)
==
'#'
)
{
id
=
id
.
substring
(
1
);
id
=
id
.
substring
(
1
);
}
}
...
...
test/javax/xml/crypto/dsig/GenerationTests.java
浏览文件 @
6cfe48a5
/*
/*
* Copyright (c) 2005, 201
3
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2005, 201
4
, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
*
* This code is free software; you can redistribute it and/or modify it
* This code is free software; you can redistribute it and/or modify it
...
@@ -23,7 +23,7 @@
...
@@ -23,7 +23,7 @@
/**
/**
* @test
* @test
* @bug 4635230 6283345 6303830 6824440 6867348 7094155
* @bug 4635230 6283345 6303830 6824440 6867348 7094155
8038184
* @summary Basic unit tests for generating XML Signatures with JSR 105
* @summary Basic unit tests for generating XML Signatures with JSR 105
* @compile -XDignore.symbol.file KeySelectors.java SignatureValidator.java
* @compile -XDignore.symbol.file KeySelectors.java SignatureValidator.java
* X509KeySelector.java GenerationTests.java
* X509KeySelector.java GenerationTests.java
...
@@ -135,6 +135,7 @@ public class GenerationTests {
...
@@ -135,6 +135,7 @@ public class GenerationTests {
test_create_signature_enveloping_sha512_rsa_sha512
();
test_create_signature_enveloping_sha512_rsa_sha512
();
test_create_signature_reference_dependency
();
test_create_signature_reference_dependency
();
test_create_signature_with_attr_in_no_namespace
();
test_create_signature_with_attr_in_no_namespace
();
test_create_signature_with_empty_id
();
}
}
private
static
void
setup
()
throws
Exception
{
private
static
void
setup
()
throws
Exception
{
...
@@ -509,6 +510,30 @@ public class GenerationTests {
...
@@ -509,6 +510,30 @@ public class GenerationTests {
System
.
out
.
println
();
System
.
out
.
println
();
}
}
static
void
test_create_signature_with_empty_id
()
throws
Exception
{
System
.
out
.
println
(
"* Generating signature-with-empty-id.xml"
);
// create references
List
<
Reference
>
refs
=
Collections
.
singletonList
(
fac
.
newReference
(
"#"
,
sha1
));
// create SignedInfo
SignedInfo
si
=
fac
.
newSignedInfo
(
withoutComments
,
rsaSha1
,
refs
);
// create object with empty id
Document
doc
=
db
.
newDocument
();
XMLObject
obj
=
fac
.
newXMLObject
(
Collections
.
singletonList
(
new
DOMStructure
(
doc
.
createTextNode
(
"I am the text."
))),
""
,
"text/plain"
,
null
);
// create XMLSignature
XMLSignature
sig
=
fac
.
newXMLSignature
(
si
,
rsa
,
Collections
.
singletonList
(
obj
),
"signature"
,
null
);
DOMSignContext
dsc
=
new
DOMSignContext
(
getPrivateKey
(
"RSA"
),
doc
);
sig
.
sign
(
dsc
);
}
static
void
test_create_signature
()
throws
Exception
{
static
void
test_create_signature
()
throws
Exception
{
System
.
out
.
println
(
"* Generating signature.xml"
);
System
.
out
.
println
(
"* Generating signature.xml"
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录