Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_jdk
提交
80f998dc
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看板
提交
80f998dc
编写于
12月 22, 2009
作者:
M
malenkov
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
6904691: Java Applet Trusted Methods Chaining Privilege Escalation Vulnerability
Reviewed-by: hawtin, peterz
上级
9153abc7
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
46 addition
and
16 deletion
+46
-16
src/share/classes/java/beans/EventHandler.java
src/share/classes/java/beans/EventHandler.java
+12
-7
src/share/classes/java/beans/Statement.java
src/share/classes/java/beans/Statement.java
+28
-3
test/java/beans/EventHandler/Test6277246.java
test/java/beans/EventHandler/Test6277246.java
+4
-4
test/java/beans/EventHandler/Test6277266.java
test/java/beans/EventHandler/Test6277266.java
+2
-2
未找到文件。
src/share/classes/java/beans/EventHandler.java
浏览文件 @
80f998dc
...
...
@@ -32,7 +32,6 @@ import java.security.AccessControlContext;
import
java.security.AccessController
;
import
java.security.PrivilegedAction
;
import
java.util.EventObject
;
import
sun.reflect.misc.MethodUtil
;
/**
...
...
@@ -279,9 +278,9 @@ import sun.reflect.misc.MethodUtil;
public
class
EventHandler
implements
InvocationHandler
{
private
Object
target
;
private
String
action
;
private
String
eventPropertyName
;
private
String
listenerMethodName
;
private
AccessControlContext
acc
;
private
final
String
eventPropertyName
;
private
final
String
listenerMethodName
;
private
final
AccessControlContext
acc
=
AccessController
.
getContext
()
;
/**
* Creates a new <code>EventHandler</code> object;
...
...
@@ -310,7 +309,6 @@ public class EventHandler implements InvocationHandler {
*/
@ConstructorProperties
({
"target"
,
"action"
,
"eventPropertyName"
,
"listenerMethodName"
})
public
EventHandler
(
Object
target
,
String
action
,
String
eventPropertyName
,
String
listenerMethodName
)
{
this
.
acc
=
AccessController
.
getContext
();
this
.
target
=
target
;
this
.
action
=
action
;
if
(
target
==
null
)
{
...
...
@@ -422,7 +420,11 @@ public class EventHandler implements InvocationHandler {
* @see EventHandler
*/
public
Object
invoke
(
final
Object
proxy
,
final
Method
method
,
final
Object
[]
arguments
)
{
return
AccessController
.
doPrivileged
(
new
PrivilegedAction
()
{
AccessControlContext
acc
=
this
.
acc
;
if
((
acc
==
null
)
&&
(
System
.
getSecurityManager
()
!=
null
))
{
throw
new
SecurityException
(
"AccessControlContext is not set"
);
}
return
AccessController
.
doPrivileged
(
new
PrivilegedAction
<
Object
>()
{
public
Object
run
()
{
return
invokeInternal
(
proxy
,
method
,
arguments
);
}
...
...
@@ -482,7 +484,10 @@ public class EventHandler implements InvocationHandler {
throw
new
RuntimeException
(
ex
);
}
catch
(
InvocationTargetException
ex
)
{
throw
new
RuntimeException
(
ex
.
getTargetException
());
Throwable
th
=
ex
.
getTargetException
();
throw
(
th
instanceof
RuntimeException
)
?
(
RuntimeException
)
th
:
new
RuntimeException
(
th
);
}
}
return
null
;
...
...
src/share/classes/java/beans/Statement.java
浏览文件 @
80f998dc
...
...
@@ -29,6 +29,10 @@ import java.lang.reflect.Array;
import
java.lang.reflect.Constructor
;
import
java.lang.reflect.InvocationTargetException
;
import
java.lang.reflect.Method
;
import
java.security.AccessControlContext
;
import
java.security.AccessController
;
import
java.security.PrivilegedActionException
;
import
java.security.PrivilegedExceptionAction
;
import
com.sun.beans.finder.ClassFinder
;
import
com.sun.beans.finder.ConstructorFinder
;
...
...
@@ -63,9 +67,10 @@ public class Statement {
}
};
Object
target
;
String
methodName
;
Object
[]
arguments
;
private
final
AccessControlContext
acc
=
AccessController
.
getContext
();
private
final
Object
target
;
private
final
String
methodName
;
private
final
Object
[]
arguments
;
ClassLoader
loader
;
/**
...
...
@@ -145,6 +150,26 @@ public class Statement {
}
Object
invoke
()
throws
Exception
{
AccessControlContext
acc
=
this
.
acc
;
if
((
acc
==
null
)
&&
(
System
.
getSecurityManager
()
!=
null
))
{
throw
new
SecurityException
(
"AccessControlContext is not set"
);
}
try
{
return
AccessController
.
doPrivileged
(
new
PrivilegedExceptionAction
<
Object
>()
{
public
Object
run
()
throws
Exception
{
return
invokeInternal
();
}
},
acc
);
}
catch
(
PrivilegedActionException
exception
)
{
throw
exception
.
getException
();
}
}
private
Object
invokeInternal
()
throws
Exception
{
Object
target
=
getTarget
();
String
methodName
=
getMethodName
();
...
...
test/java/beans/EventHandler/Test6277246.java
浏览文件 @
80f998dc
/*
* Copyright 2005-200
7
Sun Microsystems, Inc. All Rights Reserved.
* Copyright 2005-200
9
Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
...
...
@@ -49,10 +49,10 @@ public class Test6277246 {
catch
(
NoSuchMethodException
exception
)
{
throw
new
Error
(
"unexpected exception"
,
exception
);
}
catch
(
SecurityException
exception
)
{
// expected security exception
}
catch
(
RuntimeException
exception
)
{
if
(
exception
.
getCause
()
instanceof
SecurityException
)
{
return
;
// expected security exception
}
throw
new
Error
(
"unexpected exception"
,
exception
);
}
}
...
...
test/java/beans/EventHandler/Test6277266.java
浏览文件 @
80f998dc
/*
* Copyright 2005-200
7
Sun Microsystems, Inc. All Rights Reserved.
* Copyright 2005-200
9
Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
...
...
@@ -51,7 +51,7 @@ public class Test6277266 {
);
throw
new
Error
(
"SecurityException expected"
);
}
catch
(
InvocationTargetException
exception
)
{
if
(
exception
.
getCause
()
.
getCause
()
instanceof
SecurityException
){
if
(
exception
.
getCause
()
instanceof
SecurityException
){
return
;
// expected security exception
}
throw
new
Error
(
"unexpected exception"
,
exception
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录