@@ -1228,9 +1228,11 @@ readPool(J9CfrClassFile* classfile, U_8* data, U_8* dataEnd, U_8* segment, U_8*
1228
1228
return -2 ;
1229
1229
}
1230
1230
CHECK_EOF (size );
1231
- verifyResult = j9bcutil_verifyCanonisizeAndCopyUTF8 (info -> bytes , index , size );
1231
+ verifyResult = j9bcutil_verifyCanonisizeAndCopyUTF8 (info -> bytes , index , size , & ( info -> flags1 ) );
1232
1232
info -> slot1 = (U_32 ) verifyResult ;
1233
- if (verifyResult < 0 ) {
1233
+ if ((verifyResult < 0 ) ||
1234
+ (J9_ARE_ALL_BITS_SET (info -> flags1 , CFR_FOUND_CHARS_IN_EXTENDED_MUE_FORM ) && (classfile -> majorVersion >= 48 ))
1235
+ ) {
1234
1236
errorCode = J9NLS_CFR_ERR_BAD_UTF8__ID ;
1235
1237
offset = (U_32 ) (index - data - 1 );
1236
1238
goto _errorFound ;
@@ -2587,7 +2589,7 @@ checkClass(J9PortLibrary *portLib, J9CfrClassFile* classfile, U_8* segment, U_32
2587
2589
goto _errorFound ;
2588
2590
}
2589
2591
2590
- if ((value & CFR_ACC_FINAL )&& (value & CFR_ACC_ABSTRACT )) {
2592
+ if ((value & CFR_ACC_FINAL )&& (value & CFR_ACC_ABSTRACT )) {
2591
2593
errorCode = J9NLS_CFR_ERR_FINAL_ABSTRACT_CLASS__ID ;
2592
2594
offset = endOfConstantPool ;
2593
2595
goto _errorFound ;
@@ -2602,39 +2604,47 @@ checkClass(J9PortLibrary *portLib, J9CfrClassFile* classfile, U_8* segment, U_32
2602
2604
}
2603
2605
2604
2606
value = classfile -> thisClass ;
2605
- if ((!value )|| (value >= classfile -> constantPoolCount )) {
2607
+ if ((!value )|| (value >= classfile -> constantPoolCount )) {
2606
2608
errorCode = J9NLS_CFR_ERR_BAD_INDEX__ID ;
2607
2609
offset = endOfConstantPool + 2 ;
2608
2610
goto _errorFound ;
2609
2611
}
2610
2612
2611
- if ((classfile -> constantPool )&& (classfile -> constantPool [value ].tag != CFR_CONSTANT_Class )) {
2613
+ if ((classfile -> constantPool ) && (classfile -> constantPool [value ].tag != CFR_CONSTANT_Class )) {
2612
2614
errorCode = J9NLS_CFR_ERR_NOT_CLASS__ID ;
2613
2615
offset = endOfConstantPool + 2 ;
2614
2616
goto _errorFound ;
2615
2617
}
2618
+ if ((classfile -> constantPool ) && (CFR_CONSTANT_Class == classfile -> constantPool [value ].tag )) {
2619
+ value = classfile -> constantPool [classfile -> thisClass ].slot1 ;
2620
+ if (J9_ARE_ALL_BITS_SET (classfile -> constantPool [value ].flags1 , CFR_FOUND_SEPARATOR_IN_MUE_FORM ) && (classfile -> majorVersion < 48 )) {
2621
+ errorCode = J9NLS_CFR_ERR_BAD_CLASS_NAME__ID ;
2622
+ offset = endOfConstantPool + 2 ;
2623
+ goto _errorFound ;
2624
+ }
2625
+ }
2616
2626
2617
2627
value = classfile -> superClass ;
2618
- if (value >= classfile -> constantPoolCount ) {
2628
+ if (value >= classfile -> constantPoolCount ) {
2619
2629
errorCode = J9NLS_CFR_ERR_BAD_INDEX__ID ;
2620
2630
offset = endOfConstantPool + 4 ;
2621
2631
goto _errorFound ;
2622
2632
}
2623
2633
2624
- if ( value == 0 ) {
2634
+ if ( 0 == value ) {
2625
2635
/* Check against j.l.O. */
2626
2636
if (!utf8Equal (& classfile -> constantPool [classfile -> constantPool [classfile -> thisClass ].slot1 ], "java/lang/Object" , 16 )) {
2627
2637
errorCode = J9NLS_CFR_ERR_NULL_SUPER__ID ;
2628
2638
offset = endOfConstantPool + 4 ;
2629
2639
goto _errorFound ;
2630
2640
}
2631
- } else if (classfile -> constantPool [value ].tag != CFR_CONSTANT_Class ) {
2641
+ } else if (classfile -> constantPool [value ].tag != CFR_CONSTANT_Class ) {
2632
2642
errorCode = J9NLS_CFR_ERR_SUPER_NOT_CLASS__ID ;
2633
2643
offset = endOfConstantPool + 4 ;
2634
2644
goto _errorFound ;
2635
2645
}
2636
2646
2637
- for (i = 0 ; i < classfile -> interfacesCount ; i ++ ) {
2647
+ for (i = 0 ; i < classfile -> interfacesCount ; i ++ ) {
2638
2648
U_32 j ;
2639
2649
J9CfrConstantPoolInfo * cpInfo ;
2640
2650
value = classfile -> interfaces [i ];
@@ -2662,7 +2672,7 @@ checkClass(J9PortLibrary *portLib, J9CfrClassFile* classfile, U_8* segment, U_32
2662
2672
}
2663
2673
2664
2674
/* Check that interfaces subclass object. */
2665
- if (classfile -> accessFlags & CFR_ACC_INTERFACE ) {
2675
+ if (classfile -> accessFlags & CFR_ACC_INTERFACE ) {
2666
2676
/* Check against j.l.O. */
2667
2677
if (!utf8Equal (& classfile -> constantPool [classfile -> constantPool [classfile -> superClass ].slot1 ], "java/lang/Object" , 16 )) {
2668
2678
errorCode = J9NLS_CFR_ERR_INTERFACE_SUPER_NOT_OBJECT__ID ;
0 commit comments