Skip to content

Commit a24498b

Browse files
committed
8281771: Crash in java_lang_invoke_MethodType::print_signature
Reviewed-by: dholmes, shade
1 parent 1aff44b commit a24498b

File tree

1 file changed

+13
-4
lines changed

1 file changed

+13
-4
lines changed

src/hotspot/share/classfile/javaClasses.cpp

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 1997, 2021, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 1997, 2022, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -4087,11 +4087,20 @@ void java_lang_invoke_MethodType::serialize_offsets(SerializeClosure* f) {
40874087
void java_lang_invoke_MethodType::print_signature(oop mt, outputStream* st) {
40884088
st->print("(");
40894089
objArrayOop pts = ptypes(mt);
4090-
for (int i = 0, limit = pts->length(); i < limit; i++) {
4091-
java_lang_Class::print_signature(pts->obj_at(i), st);
4090+
if (pts != NULL) {
4091+
for (int i = 0, limit = pts->length(); i < limit; i++) {
4092+
java_lang_Class::print_signature(pts->obj_at(i), st);
4093+
}
4094+
} else {
4095+
st->print("NULL");
40924096
}
40934097
st->print(")");
4094-
java_lang_Class::print_signature(rtype(mt), st);
4098+
oop rt = rtype(mt);
4099+
if (rt != NULL) {
4100+
java_lang_Class::print_signature(rt, st);
4101+
} else {
4102+
st->print("NULL");
4103+
}
40954104
}
40964105

40974106
Symbol* java_lang_invoke_MethodType::as_signature(oop mt, bool intern_if_not_found) {

0 commit comments

Comments
 (0)