mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-28 15:24:43 +02:00
8167333: Invalid source path info might be used when creating ClassFileStream after CFLH transforms a shared classes in some cases
Use NULL as 'source' when there is no valid source path info. Reviewed-by: iklam, dholmes, dsamersoff
This commit is contained in:
parent
da45a98b46
commit
4d9fc9541d
3 changed files with 7 additions and 2 deletions
|
@ -74,7 +74,7 @@ instanceKlassHandle KlassFactory::check_shared_class_file_load_hook(
|
|||
(SharedClassPathEntry*)FileMapInfo::shared_classpath(path_index);
|
||||
ClassFileStream* stream = new ClassFileStream(ptr,
|
||||
end_ptr - ptr,
|
||||
ent->_name,
|
||||
ent == NULL ? NULL : ent->_name,
|
||||
ClassFileStream::verify);
|
||||
ClassFileParser parser(stream,
|
||||
class_name,
|
||||
|
|
|
@ -1234,7 +1234,7 @@ bool SystemDictionary::is_shared_class_visible(Symbol* class_name,
|
|||
SharedClassPathEntry* ent =
|
||||
(SharedClassPathEntry*)FileMapInfo::shared_classpath(path_index);
|
||||
if (!Universe::is_module_initialized()) {
|
||||
assert(ent->is_jrt(),
|
||||
assert(ent != NULL && ent->is_jrt(),
|
||||
"Loading non-bootstrap classes before the module system is initialized");
|
||||
assert(class_loader.is_null(), "sanity");
|
||||
return true;
|
||||
|
@ -1257,6 +1257,7 @@ bool SystemDictionary::is_shared_class_visible(Symbol* class_name,
|
|||
}
|
||||
|
||||
if (class_loader.is_null()) {
|
||||
assert(ent != NULL, "Shared class for NULL classloader must have valid SharedClassPathEntry");
|
||||
// The NULL classloader can load archived class originated from the
|
||||
// "modules" jimage and the -Xbootclasspath/a. For class from the
|
||||
// "modules" jimage, the PackageEntry/ModuleEntry must be defined
|
||||
|
|
|
@ -283,11 +283,15 @@ public:
|
|||
bool validate_classpath_entry_table();
|
||||
|
||||
static SharedClassPathEntry* shared_classpath(int index) {
|
||||
if (index < 0) {
|
||||
return NULL;
|
||||
}
|
||||
char* p = (char*)_classpath_entry_table;
|
||||
p += _classpath_entry_size * index;
|
||||
return (SharedClassPathEntry*)p;
|
||||
}
|
||||
static const char* shared_classpath_name(int index) {
|
||||
assert(index >= 0, "Sanity");
|
||||
return shared_classpath(index)->_name;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue