Skip to content

Commit

Permalink
8287854: Dangling reference in ClassVerifier::verify_class
Browse files Browse the repository at this point in the history
Reviewed-by: dholmes, coleenp
  • Loading branch information
Harold Seigel committed Jun 9, 2022
1 parent 4285e3d commit 3fa9984
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 13 deletions.
8 changes: 2 additions & 6 deletions src/hotspot/share/classfile/verifier.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -594,7 +594,7 @@ void ErrorContext::stackmap_details(outputStream* ss, const Method* method) cons

ClassVerifier::ClassVerifier(JavaThread* current, InstanceKlass* klass)
: _thread(current), _previous_symbol(NULL), _symbols(NULL), _exception_type(NULL),
_message(NULL), _method_signatures_table(NULL), _klass(klass) {
_message(NULL), _klass(klass) {
_this_type = VerificationType::reference_type(klass->name());
}

Expand Down Expand Up @@ -625,16 +625,12 @@ void ClassVerifier::verify_class(TRAPS) {
// Either verifying both local and remote classes or just remote classes.
assert(BytecodeVerificationRemote, "Should not be here");

// Create hash table containing method signatures.
method_signatures_table_type method_signatures_table;
set_method_signatures_table(&method_signatures_table);

Array<Method*>* methods = _klass->methods();
int num_methods = methods->length();

for (int index = 0; index < num_methods; index++) {
// Check for recursive re-verification before each method.
if (was_recursively_verified()) return;
if (was_recursively_verified()) return;

Method* m = methods->at(index);
if (m->is_native() || m->is_abstract() || m->is_overpass()) {
Expand Down
10 changes: 3 additions & 7 deletions src/hotspot/share/classfile/verifier.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@ class ClassVerifier : public StackObj {
Symbol* _exception_type;
char* _message;

method_signatures_table_type* _method_signatures_table;
method_signatures_table_type _method_signatures_table;

ErrorContext _error_context; // contains information about an error

Expand Down Expand Up @@ -437,12 +437,8 @@ class ClassVerifier : public StackObj {

Klass* load_class(Symbol* name, TRAPS);

method_signatures_table_type* method_signatures_table() const {
return _method_signatures_table;
}

void set_method_signatures_table(method_signatures_table_type* method_signatures_table) {
_method_signatures_table = method_signatures_table;
method_signatures_table_type* method_signatures_table() {
return &_method_signatures_table;
}

int change_sig_to_verificationType(
Expand Down

0 comments on commit 3fa9984

Please sign in to comment.