@@ -1794,6 +1794,7 @@ void ClassFileParser::throwIllegalSignature(const char* type,
1794
1794
assert (sig != nullptr , " invariant" );
1795
1795
1796
1796
ResourceMark rm (THREAD);
1797
+ // Names are all known to be < 64k so we know this formatted message is not excessively large.
1797
1798
Exceptions::fthrow (THREAD_AND_LOCATION,
1798
1799
vmSymbols::java_lang_ClassFormatError (),
1799
1800
" %s \" %s\" in class %s has illegal signature \" %s\" " , type,
@@ -4073,6 +4074,8 @@ void ClassFileParser::check_super_class_access(const InstanceKlass* this_klass,
4073
4074
char * msg = Reflection::verify_class_access_msg (this_klass,
4074
4075
InstanceKlass::cast (super),
4075
4076
vca_result);
4077
+
4078
+ // Names are all known to be < 64k so we know this formatted message is not excessively large.
4076
4079
if (msg == nullptr ) {
4077
4080
bool same_module = (this_klass->module () == super->module ());
4078
4081
Exceptions::fthrow (
@@ -4121,6 +4124,8 @@ void ClassFileParser::check_super_interface_access(const InstanceKlass* this_kla
4121
4124
char * msg = Reflection::verify_class_access_msg (this_klass,
4122
4125
k,
4123
4126
vca_result);
4127
+
4128
+ // Names are all known to be < 64k so we know this formatted message is not excessively large.
4124
4129
if (msg == nullptr ) {
4125
4130
bool same_module = (this_klass->module () == k->module ());
4126
4131
Exceptions::fthrow (
@@ -4217,6 +4222,8 @@ static void check_illegal_static_method(const InstanceKlass* this_klass, TRAPS)
4217
4222
// if m is static and not the init method, throw a verify error
4218
4223
if ((m->is_static ()) && (m->name () != vmSymbols::class_initializer_name ())) {
4219
4224
ResourceMark rm (THREAD);
4225
+
4226
+ // Names are all known to be < 64k so we know this formatted message is not excessively large.
4220
4227
Exceptions::fthrow (
4221
4228
THREAD_AND_LOCATION,
4222
4229
vmSymbols::java_lang_VerifyError (),
@@ -4236,6 +4243,7 @@ void ClassFileParser::verify_legal_class_modifiers(jint flags, TRAPS) const {
4236
4243
assert (_major_version >= JAVA_9_VERSION || !is_module, " JVM_ACC_MODULE should not be set" );
4237
4244
if (is_module) {
4238
4245
ResourceMark rm (THREAD);
4246
+ // Names are all known to be < 64k so we know this formatted message is not excessively large.
4239
4247
Exceptions::fthrow (
4240
4248
THREAD_AND_LOCATION,
4241
4249
vmSymbols::java_lang_NoClassDefFoundError (),
@@ -4259,6 +4267,7 @@ void ClassFileParser::verify_legal_class_modifiers(jint flags, TRAPS) const {
4259
4267
(is_interface && major_gte_1_5 && (is_super || is_enum)) ||
4260
4268
(!is_interface && major_gte_1_5 && is_annotation)) {
4261
4269
ResourceMark rm (THREAD);
4270
+ // Names are all known to be < 64k so we know this formatted message is not excessively large.
4262
4271
Exceptions::fthrow (
4263
4272
THREAD_AND_LOCATION,
4264
4273
vmSymbols::java_lang_ClassFormatError (),
@@ -4295,6 +4304,7 @@ void ClassFileParser::verify_class_version(u2 major, u2 minor, Symbol* class_nam
4295
4304
}
4296
4305
4297
4306
if (major > max_version) {
4307
+ // Names are all known to be < 64k so we know this formatted message is not excessively large.
4298
4308
Exceptions::fthrow (
4299
4309
THREAD_AND_LOCATION,
4300
4310
vmSymbols::java_lang_UnsupportedClassVersionError (),
@@ -4310,6 +4320,7 @@ void ClassFileParser::verify_class_version(u2 major, u2 minor, Symbol* class_nam
4310
4320
4311
4321
if (minor == JAVA_PREVIEW_MINOR_VERSION) {
4312
4322
if (major != max_version) {
4323
+ // Names are all known to be < 64k so we know this formatted message is not excessively large.
4313
4324
Exceptions::fthrow (
4314
4325
THREAD_AND_LOCATION,
4315
4326
vmSymbols::java_lang_UnsupportedClassVersionError (),
@@ -4362,6 +4373,7 @@ void ClassFileParser::verify_legal_field_modifiers(jint flags,
4362
4373
4363
4374
if (is_illegal) {
4364
4375
ResourceMark rm (THREAD);
4376
+ // Names are all known to be < 64k so we know this formatted message is not excessively large.
4365
4377
Exceptions::fthrow (
4366
4378
THREAD_AND_LOCATION,
4367
4379
vmSymbols::java_lang_ClassFormatError (),
@@ -4445,6 +4457,7 @@ void ClassFileParser::verify_legal_method_modifiers(jint flags,
4445
4457
4446
4458
if (is_illegal) {
4447
4459
ResourceMark rm (THREAD);
4460
+ // Names are all known to be < 64k so we know this formatted message is not excessively large.
4448
4461
Exceptions::fthrow (
4449
4462
THREAD_AND_LOCATION,
4450
4463
vmSymbols::java_lang_ClassFormatError (),
@@ -4686,6 +4699,7 @@ void ClassFileParser::verify_legal_class_name(const Symbol* name, TRAPS) const {
4686
4699
if (!legal) {
4687
4700
ResourceMark rm (THREAD);
4688
4701
assert (_class_name != nullptr , " invariant" );
4702
+ // Names are all known to be < 64k so we know this formatted message is not excessively large.
4689
4703
Exceptions::fthrow (
4690
4704
THREAD_AND_LOCATION,
4691
4705
vmSymbols::java_lang_ClassFormatError (),
@@ -4719,6 +4733,7 @@ void ClassFileParser::verify_legal_field_name(const Symbol* name, TRAPS) const {
4719
4733
if (!legal) {
4720
4734
ResourceMark rm (THREAD);
4721
4735
assert (_class_name != nullptr , " invariant" );
4736
+ // Names are all known to be < 64k so we know this formatted message is not excessively large.
4722
4737
Exceptions::fthrow (
4723
4738
THREAD_AND_LOCATION,
4724
4739
vmSymbols::java_lang_ClassFormatError (),
@@ -4756,6 +4771,7 @@ void ClassFileParser::verify_legal_method_name(const Symbol* name, TRAPS) const
4756
4771
if (!legal) {
4757
4772
ResourceMark rm (THREAD);
4758
4773
assert (_class_name != nullptr , " invariant" );
4774
+ // Names are all known to be < 64k so we know this formatted message is not excessively large.
4759
4775
Exceptions::fthrow (
4760
4776
THREAD_AND_LOCATION,
4761
4777
vmSymbols::java_lang_ClassFormatError (),
@@ -5527,6 +5543,7 @@ void ClassFileParser::parse_stream(const ClassFileStream* const stream,
5527
5543
if (_class_name != class_name_in_cp) {
5528
5544
if (_class_name != vmSymbols::unknown_class_name ()) {
5529
5545
ResourceMark rm (THREAD);
5546
+ // Names are all known to be < 64k so we know this formatted message is not excessively large.
5530
5547
Exceptions::fthrow (THREAD_AND_LOCATION,
5531
5548
vmSymbols::java_lang_NoClassDefFoundError (),
5532
5549
" %s (wrong name: %s)" ,
0 commit comments