Skip to content

Commit 96df5a6

Browse files
author
David Holmes
committed
8339316: Test runtime/exceptionMsgs/NoClassDefFoundError/NoClassDefFoundErrorTest.java fails after JDK-8338257
Reviewed-by: jsjolen, coleenp
1 parent 55312e1 commit 96df5a6

File tree

7 files changed

+7
-10
lines changed

7 files changed

+7
-10
lines changed

src/hotspot/share/cds/classListParser.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -463,7 +463,7 @@ void ClassListParser::check_class_name(const char* class_name) {
463463
err = "class name too long";
464464
} else {
465465
assert(Symbol::max_length() < INT_MAX && len < INT_MAX, "must be");
466-
if (!UTF8::is_legal_utf8((const unsigned char*)class_name, (int)len, /*version_leq_47*/false)) {
466+
if (!UTF8::is_legal_utf8((const unsigned char*)class_name, len, /*version_leq_47*/false)) {
467467
err = "class name is not valid UTF8";
468468
}
469469
}
@@ -849,4 +849,3 @@ void ClassListParser::parse_constant_pool_tag() {
849849
ClassPrelinker::preresolve_field_and_method_cp_entries(THREAD, ik, &preresolve_list);
850850
}
851851
}
852-

src/hotspot/share/classfile/classFileParser.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4559,7 +4559,8 @@ void ClassFileParser::verify_legal_utf8(const unsigned char* buffer,
45594559
int length,
45604560
TRAPS) const {
45614561
assert(_need_verify, "only called when _need_verify is true");
4562-
if (!UTF8::is_legal_utf8(buffer, length, _major_version <= 47)) {
4562+
// Note: 0 <= length < 64K, as it comes from a u2 entry in the CP.
4563+
if (!UTF8::is_legal_utf8(buffer, static_cast<size_t>(length), _major_version <= 47)) {
45634564
classfile_parse_error("Illegal UTF8 string in constant pool in class file %s", THREAD);
45644565
}
45654566
}

src/hotspot/share/classfile/systemDictionary.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -285,8 +285,7 @@ Symbol* SystemDictionary::class_name_symbol(const char* name, Symbol* exception,
285285
return nullptr;
286286
}
287287
// Callers should ensure that the name is never an illegal UTF8 string.
288-
assert(UTF8::is_legal_utf8((const unsigned char*)name,
289-
static_cast<int>(name_len), false),
288+
assert(UTF8::is_legal_utf8((const unsigned char*)name, name_len, false),
290289
"Class name is not a valid utf8 string.");
291290

292291
// Make a new symbol for the class name.

src/hotspot/share/prims/jniCheck.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -475,7 +475,7 @@ void jniCheck::validate_class_descriptor(JavaThread* thr, const char* name) {
475475
}
476476

477477
// Verify that the class name given is a valid utf8 string
478-
if (!UTF8::is_legal_utf8((const unsigned char*)name, (int)strlen(name), false)) {
478+
if (!UTF8::is_legal_utf8((const unsigned char*)name, strlen(name), false)) {
479479
char msg[JVM_MAXPATHLEN];
480480
jio_snprintf(msg, JVM_MAXPATHLEN, "%s%s%s", fatal_non_utf8_class_name1, name, fatal_non_utf8_class_name2);
481481
ReportJNIFatalError(thr, msg);

src/hotspot/share/prims/jvm.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -809,7 +809,7 @@ JVM_ENTRY(jclass, JVM_FindClassFromBootLoader(JNIEnv* env,
809809
// into the constant pool.
810810
return nullptr;
811811
}
812-
assert(UTF8::is_legal_utf8((const unsigned char*)name, (int)strlen(name), false), "illegal UTF name");
812+
assert(UTF8::is_legal_utf8((const unsigned char*)name, strlen(name), false), "illegal UTF name");
813813

814814
TempNewSymbol h_name = SymbolTable::new_symbol(name);
815815
Klass* k = SystemDictionary::resolve_or_null(h_name, CHECK_NULL);

src/hotspot/share/utilities/exceptions.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -288,7 +288,7 @@ void Exceptions::fthrow(JavaThread* thread, const char* file, int line, Symbol*
288288
// parameter controls a check for a specific character appearing in the "name", which is only
289289
// allowed for classfile versions <= 47. We pass `true` so that we allow such strings as this code
290290
// know nothing about the actual string content.
291-
assert(UTF8::is_legal_utf8((const unsigned char*)msg, (int)strlen(msg), true), "must be");
291+
assert(UTF8::is_legal_utf8((const unsigned char*)msg, strlen(msg), true), "must be");
292292
_throw_msg(thread, file, line, h_name, msg);
293293
}
294294

test/hotspot/jtreg/ProblemList.txt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,8 +118,6 @@ runtime/ErrorHandling/TestDwarf.java#checkDecoder 8305489 linux-all
118118
runtime/ErrorHandling/MachCodeFramesInErrorFile.java 8313315 linux-ppc64le
119119
runtime/Thread/TestAlwaysPreTouchStacks.java 8335167 macosx-aarch64
120120
runtime/cds/appcds/customLoader/HelloCustom_JFR.java 8241075 linux-all,windows-x64
121-
runtime/exceptionMsgs/NoClassDefFoundError/NoClassDefFoundErrorTest.java 8339316 generic-all
122-
123121

124122
applications/jcstress/copy.java 8229852 linux-all
125123

0 commit comments

Comments
 (0)