Skip to content
This repository has been archived by the owner. It is now read-only.
Permalink
Browse files
8251918: [Graal] Crash in DumpTimeSharedClassInfo::add_verification_c…
…onstraint

Add NULL check on the return value of SystemDictionaryShared::find_or_allocate_info_for().

Reviewed-by: iklam, minqi
  • Loading branch information
calvinccheung committed Aug 22, 2020
1 parent 59d5f4d commit ac4a6c9989ac56792d690e4c93a72c30b0cab34a
Showing with 19 additions and 8 deletions.
  1. +19 −8 src/hotspot/share/classfile/systemDictionaryShared.cpp
@@ -1201,8 +1201,10 @@ void SystemDictionaryShared::set_shared_class_misc_info(InstanceKlass* k, ClassF
Arguments::assert_is_dumping_archive();
assert(!is_builtin(k), "must be unregistered class");
DumpTimeSharedClassInfo* info = find_or_allocate_info_for(k);
info->_clsfile_size = cfs->length();
info->_clsfile_crc32 = ClassLoader::crc32(0, (const char*)cfs->buffer(), cfs->length());
if (info != NULL) {
info->_clsfile_size = cfs->length();
info->_clsfile_crc32 = ClassLoader::crc32(0, (const char*)cfs->buffer(), cfs->length());
}
}

void SystemDictionaryShared::init_dumptime_info(InstanceKlass* k) {
@@ -1398,12 +1400,16 @@ void SystemDictionaryShared::check_excluded_classes() {
bool SystemDictionaryShared::is_excluded_class(InstanceKlass* k) {
assert(_no_class_loading_should_happen, "sanity");
Arguments::assert_is_dumping_archive();
return find_or_allocate_info_for(k)->is_excluded();
DumpTimeSharedClassInfo* p = find_or_allocate_info_for(k);
return (p == NULL) ? true : p->is_excluded();
}

void SystemDictionaryShared::set_class_has_failed_verification(InstanceKlass* ik) {
Arguments::assert_is_dumping_archive();
find_or_allocate_info_for(ik)->set_failed_verification();
DumpTimeSharedClassInfo* p = find_or_allocate_info_for(ik);
if (p != NULL) {
p->set_failed_verification();
}
}

bool SystemDictionaryShared::has_class_failed_verification(InstanceKlass* ik) {
@@ -1440,9 +1446,12 @@ bool SystemDictionaryShared::add_verification_constraint(InstanceKlass* k, Symbo
Symbol* from_name, bool from_field_is_protected, bool from_is_array, bool from_is_object) {
Arguments::assert_is_dumping_archive();
DumpTimeSharedClassInfo* info = find_or_allocate_info_for(k);
info->add_verification_constraint(k, name, from_name, from_field_is_protected,
from_is_array, from_is_object);

if (info != NULL) {
info->add_verification_constraint(k, name, from_name, from_field_is_protected,
from_is_array, from_is_object);
} else {
return true;
}
if (DynamicDumpSharedSpaces) {
// For dynamic dumping, we can resolve all the constraint classes for all class loaders during
// the initial run prior to creating the archive before vm exit. We will also perform verification
@@ -1771,7 +1780,9 @@ void SystemDictionaryShared::record_linking_constraint(Symbol* name, InstanceKla
}
Arguments::assert_is_dumping_archive();
DumpTimeSharedClassInfo* info = find_or_allocate_info_for(klass);
info->record_linking_constraint(name, loader1, loader2);
if (info != NULL) {
info->record_linking_constraint(name, loader1, loader2);
}
}

// returns true IFF there's no need to re-initialize the i/v-tables for klass for

0 comments on commit ac4a6c9

Please sign in to comment.