1 Star 0 Fork 82

MYX/openjdk-1.8.0

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
update-to-keep-same-with-master.patch 3.38 KB
一键复制 编辑 原始数据 按行查看 历史
From 0b24d78d6e226413d9e95eb13646a313dd2396ef Mon Sep 17 00:00:00 2001
From: zhangyipeng <zhangyipeng7@huawei.com>
Date: Thu, 11 Mar 2021 16:31:50 +0800
Subject: [PATCH] [Huawei]update to keep same with master
Signed-off-by: Lin Haibing <linhaibing@huawei.com>
---
.../share/vm/classfile/systemDictionary.cpp | 51 +++++++++----------
4 files changed, 28 insertions(+), 28 deletions(-)
diff --git a/hotspot/src/share/vm/classfile/systemDictionary.cpp b/hotspot/src/share/vm/classfile/systemDictionary.cpp
index c3dec0a30..201dd9594 100644
--- a/hotspot/src/share/vm/classfile/systemDictionary.cpp
+++ b/hotspot/src/share/vm/classfile/systemDictionary.cpp
@@ -1097,7 +1097,7 @@ static char* convert_into_package_name(char* name) {
char* index = strrchr(name, '/');
if (index == NULL) {
return NULL;
- } else {
+ } else {
*index = '\0'; // chop to just the package name
while ((index = strchr(name, '/')) != NULL) {
*index = '.'; // replace '/' with '.' in package name
@@ -1170,29 +1170,32 @@ Klass* SystemDictionary::resolve_from_stream(Symbol* class_name,
!class_loader.is_null() &&
parsed_name != NULL &&
parsed_name->utf8_length() >= (int)pkglen) {
- ResourceMark rm(THREAD);
- bool prohibited;
- const jbyte* base = parsed_name->base();
- if ((base[0] | base[1] | base[2] | base[3] | base[4]) & 0x80) {
- prohibited = is_prohibited_package_slow(parsed_name);
- } else {
- char* name = parsed_name->as_C_string();
- prohibited = (strncmp(name, pkg, pkglen) == 0);
- }
- if (prohibited) {
- // It is illegal to define classes in the "java." package from
- // JVM_DefineClass or jni_DefineClass unless you're the bootclassloader
- char* name = parsed_name->as_C_string();
- name = convert_into_package_name(name);
- assert(name != NULL, "must be");
-
- const char* fmt = "Prohibited package name: %s";
- size_t len = strlen(fmt) + strlen(name);
- char* message = NEW_RESOURCE_ARRAY(char, len);
- jio_snprintf(message, len, fmt, name);
- Exceptions::_throw_msg(THREAD_AND_LOCATION,
- vmSymbols::java_lang_SecurityException(), message);
- }
+ ResourceMark rm(THREAD);
+ bool prohibited;
+ const jbyte* base = parsed_name->base();
+ if ((base[0] | base[1] | base[2] | base[3] | base[4]) & 0x80) {
+ prohibited = is_prohibited_package_slow(parsed_name);
+ } else {
+ char* name = parsed_name->as_C_string();
+ prohibited = (strncmp(name, pkg, pkglen) == 0);
+ }
+ if (prohibited) {
+ // It is illegal to define classes in the "java." package from
+ // JVM_DefineClass or jni_DefineClass unless you're the bootclassloader
+ char* name = parsed_name->as_C_string();
+ char* index = strrchr(name, '/');
+ assert(index != NULL, "must be");
+ *index = '\0'; // chop to just the package name
+ while ((index = strchr(name, '/')) != NULL) {
+ *index = '.'; // replace '/' with '.' in package name
+ }
+ const char* fmt = "Prohibited package name: %s";
+ size_t len = strlen(fmt) + strlen(name);
+ char* message = NEW_RESOURCE_ARRAY(char, len);
+ jio_snprintf(message, len, fmt, name);
+ Exceptions::_throw_msg(THREAD_AND_LOCATION,
+ vmSymbols::java_lang_SecurityException(), message);
+ }
}
if (!HAS_PENDING_EXCEPTION) {
--
2.19.0
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/myx_076/openjdk-1.8.0.git
git@gitee.com:myx_076/openjdk-1.8.0.git
myx_076
openjdk-1.8.0
openjdk-1.8.0
master

搜索帮助