-
Notifications
You must be signed in to change notification settings - Fork 746
/
Copy pathcfreader.c
3930 lines (3462 loc) · 129 KB
/
cfreader.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/*******************************************************************************
* Copyright IBM Corp. and others 1991
*
* This program and the accompanying materials are made available under
* the terms of the Eclipse Public License 2.0 which accompanies this
* distribution and is available at https://www.eclipse.org/legal/epl-2.0/
* or the Apache License, Version 2.0 which accompanies this distribution and
* is available at https://www.apache.org/licenses/LICENSE-2.0.
*
* This Source Code may also be made available under the following
* Secondary Licenses when the conditions for such availability set
* forth in the Eclipse Public License, v. 2.0 are satisfied: GNU
* General Public License, version 2 with the GNU Classpath
* Exception [1] and GNU General Public License, version 2 with the
* OpenJDK Assembly Exception [2].
*
* [1] https://www.gnu.org/software/classpath/license.html
* [2] https://openjdk.org/legal/assembly-exception.html
*
* SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 OR GPL-2.0-only WITH OpenJDK-assembly-exception-1.0
*******************************************************************************/
#include "cfreader.h"
#include "j9protos.h"
#include "j9user.h"
#include <string.h>
#include "ut_j9bcu.h"
#include "j9bcvnls.h"
#include "romphase.h"
#include "bcutil_internal.h"
#include "util_api.h"
/*
* Note: The attrlookup.h file contains a generated perfect hash table
* for fast lookup of known attributes. It is used by attributeTagFor().
*
* It was generated using the gperf utility via the following command line:
*
* gperf -CD -t attrlookup.gperf
*
* (The gperf utility is a perfect hash function generator that is readily available on Linux.)
*
*/
#include "attrlookup.h"
static I_32 checkAttributes (J9PortLibrary* portLib, J9CfrClassFile* classfile, J9CfrAttribute** attributes, U_32 attributesCount, U_8* segment, I_32 maxBootstrapMethodIndex, U_32 extra, U_32 flags);
static I_32 readAttributes (J9CfrClassFile * classfile, J9CfrAttribute *** pAttributes, U_32 attributesCount, U_8 * data, U_8 * dataEnd, U_8 * segment, U_8 * segmentEnd, U_8 ** pIndex, U_8 ** pFreePointer, U_32 flags, UDATA * syntheticFound);
static I_32 checkFields (J9PortLibrary* portLib, J9CfrClassFile * classfile, U_8 * segment, U_32 flags);
static U_8 attributeTagFor (J9CfrConstantPoolInfo *utf8, BOOLEAN stripDebugAttributes);
static I_32 readAnnotations (J9CfrClassFile * classfile, J9CfrAnnotation * pAnnotations, U_32 annotationCount, U_8 * data, U_8 * dataEnd, U_8 * segment, U_8 * segmentEnd, U_8 ** pIndex, U_8 ** pFreePointer, U_32 flags);
static I_32 readTypeAnnotation (J9CfrClassFile * classfile, J9CfrTypeAnnotation * pAnnotations, U_8 * data, U_8 * dataEnd, U_8 * segment, U_8 * segmentEnd, U_8 ** pIndex, U_8 ** pFreePointer, U_32 flags);
static I_32 readAnnotationElement (J9CfrClassFile * classfile, J9CfrAnnotationElement ** pAnnotationElement, U_8 * data, U_8 * dataEnd, U_8 * segment, U_8 * segmentEnd, U_8 ** pIndex, U_8 ** pFreePointer, U_32 flags);
static I_32 checkClassVersion (J9CfrClassFile* classfile, U_8* segment, U_32 vmVersionShifted, U_32 flags);
static BOOLEAN utf8EqualUtf8 (J9CfrConstantPoolInfo *utf8a, J9CfrConstantPoolInfo *utf8b);
static BOOLEAN utf8Equal (J9CfrConstantPoolInfo* utf8, char* string, UDATA length);
static I_32 readMethods (J9CfrClassFile* classfile, U_8* data, U_8* dataEnd, U_8* segment, U_8* segmentEnd, U_8** pIndex, U_8** pFreePointer, U_32 flags);
static I_32 readPool (J9CfrClassFile* classfile, U_8* data, U_8* dataEnd, U_8* segment, U_8* segmentEnd, U_8** pIndex, U_8** pFreePointer);
static I_32 checkDuplicateMembers (J9PortLibrary* portLib, J9CfrClassFile * classfile, U_8 * segment, U_32 flags, UDATA memberSize);
static I_32 checkPool (J9CfrClassFile* classfile, U_8* segment, U_8* poolStart, I_32 *maxBootstrapMethodIndex, U_32 flags);
static I_32 checkClass (J9PortLibrary *portLib, J9CfrClassFile* classfile, U_8* segment, U_32 endOfConstantPool, U_32 vmVersionShifted, U_32 flags);
static I_32 readFields (J9CfrClassFile* classfile, U_8* data, U_8* dataEnd, U_8* segment, U_8* segmentEnd, U_8** pIndex, U_8** pFreePointer, U_32 flags);
static I_32 checkMethods (J9PortLibrary* portLib, J9CfrClassFile* classfile, U_8* segment, U_32 vmVersionShifted, U_32 flags);
static BOOLEAN memberEqual (J9CfrClassFile * classfile, J9CfrMember* a, J9CfrMember* b);
static void sortMethodIndex(J9CfrConstantPoolInfo* constantPool, J9CfrMethod *list, IDATA start, IDATA end);
static IDATA compareMethodIDs(J9CfrConstantPoolInfo* constantPool, J9CfrMethod *a, J9CfrMethod *b);
static U_8* getUTF8Data(J9CfrConstantPoolInfo* constantPool, U_16 cpIndex);
static U_16 getUTF8Length(J9CfrConstantPoolInfo* constantPool, U_16 cpIndex);
#define OUTSIDE_CODE ((U_32) -1)
/* set DUP_TIMING to 1 to determine the best value
* for DUP_HASH_THRESHOLD on a particular
* platform
*/
#define DUP_TIMING 0
#define DUP_HASH_THRESHOLD 30
#define MAX_CONSTANT_POOL_SIZE 0xFFFF
/* mapping characters A..Z */
static const U_8 cpTypeCharConversion[] = {
0, CFR_CONSTANT_Integer, CFR_CONSTANT_Integer, CFR_CONSTANT_Double,
0, CFR_CONSTANT_Float, 0, 0,
CFR_CONSTANT_Integer, CFR_CONSTANT_Long, 0, CFR_CONSTANT_String,
0, 0, 0, 0,
0, 0, CFR_CONSTANT_Integer, 0,
0, 0, 0, 0,
0, CFR_CONSTANT_Integer};
/*
Compare a J9CfrConstantUtf8 to a C string.
*/
static BOOLEAN
utf8Equal(J9CfrConstantPoolInfo* utf8, char* string, UDATA length)
{
if ((utf8->tag !=CFR_CONSTANT_Utf8) || (utf8->slot1 != length)) {
return FALSE;
}
return memcmp(utf8->bytes, string, length) == 0;
}
/*
Compare an J9CfrConstantPoolInfo to the known attribute
names. Return a tag value for any known attribute,
0 for an unknown one.
*/
static U_8
attributeTagFor(J9CfrConstantPoolInfo *utf8, BOOLEAN stripDebugAttributes)
{
const struct AttribType *attribType = lookupKnownAttribute((const char *)utf8->bytes, (size_t)utf8->slot1);
if (NULL != attribType) {
return (stripDebugAttributes ? attribType->strippedAttribCode : attribType->attribCode);
}
return (U_8) (stripDebugAttributes
? CFR_ATTRIBUTE_StrippedUnknown
: CFR_ATTRIBUTE_Unknown);
}
/*
Read the attributes from the bytes in @data.
Returns 0 on success, non-zero on failure.
*/
static I_32
readAttributes(J9CfrClassFile * classfile, J9CfrAttribute *** pAttributes, U_32 attributesCount, U_8 * data,
U_8 * dataEnd, U_8 * segment, U_8 * segmentEnd, U_8 ** pIndex, U_8 ** pFreePointer, U_32 flags, UDATA * syntheticFound)
{
J9CfrAttribute **attributes = *pAttributes;
U_8 *index = *pIndex;
U_8 *freePointer = *pFreePointer;
J9CfrConstantPoolInfo *info;
J9CfrAttribute *attrib;
J9CfrAttributeCode *code;
J9CfrAttributeExceptions *exceptions;
J9CfrExceptionTableEntry *exception;
J9CfrAttributeInnerClasses *classes;
J9CfrParameterAnnotations *parameterAnnotations;
J9CfrTypeAnnotation *typeAnnotations = NULL;
J9CfrAttributeStackMap *stackMap;
J9CfrAttributeBootstrapMethods *bootstrapMethods;
J9CfrAttributeRecord *record;
J9CfrAttributePermittedSubclasses *permittedSubclasses;
#if defined(J9VM_OPT_VALHALLA_VALUE_TYPES)
J9CfrAttributeLoadableDescriptors *loadableDescriptors;
#endif /* defined(J9VM_OPT_VALHALLA_VALUE_TYPES) */
#if defined(J9VM_OPT_VALHALLA_FLATTENABLE_VALUE_TYPES)
J9CfrAttributeImplicitCreation *implicitCreation;
#endif /* defined(J9VM_OPT_VALHALLA_FLATTENABLE_VALUE_TYPES) */
#if JAVA_SPEC_VERSION >= 11
J9CfrAttributeNestHost *nestHost;
J9CfrAttributeNestMembers *nestMembers;
#endif /* JAVA_SPEC_VERSION >= 11 */
U_32 name, length;
U_32 tag, errorCode, offset;
U_8 *end;
U_32 address;
U_32 i, j, k;
I_32 result;
BOOLEAN sourceFileAttributeRead = FALSE;
BOOLEAN bootstrapMethodAttributeRead = FALSE;
BOOLEAN visibleTypeAttributeRead = FALSE;
BOOLEAN invisibleTypeAttributeRead = FALSE;
BOOLEAN sourceDebugExtensionRead = FALSE;
BOOLEAN annotationDefaultRead = FALSE;
BOOLEAN visibleAnnotationsRead = FALSE;
BOOLEAN invisibleAnnotationsRead = FALSE;
BOOLEAN visibleParameterAnnotationsRead = FALSE;
BOOLEAN invisibleParameterAnnotationsRead = FALSE;
BOOLEAN recordAttributeRead = FALSE;
BOOLEAN permittedSubclassesAttributeRead = FALSE;
#if defined(J9VM_OPT_VALHALLA_VALUE_TYPES)
BOOLEAN loadableDescriptorsAttributeRead = FALSE;
#endif /* defined(J9VM_OPT_VALHALLA_VALUE_TYPES) */
#if defined(J9VM_OPT_VALHALLA_FLATTENABLE_VALUE_TYPES)
BOOLEAN implicitCreationAttributeRead = FALSE;
BOOLEAN nullRestrictedAttributeRead = FALSE;
#endif /* defined(J9VM_OPT_VALHALLA_FLATTENABLE_VALUE_TYPES) */
#if JAVA_SPEC_VERSION >= 11
BOOLEAN nestAttributeRead = FALSE;
#endif /* JAVA_SPEC_VERSION >= 11 */
if (NULL != syntheticFound) {
*syntheticFound = FALSE;
}
for (i = 0; i < attributesCount; i++) {
address = (U_32) (index - data);
CHECK_EOF(6);
NEXT_U16(name, index);
NEXT_U32(length, index);
end = index + length;
if ((!name) || (name >= classfile->constantPoolCount)) {
errorCode = J9NLS_CFR_ERR_BAD_INDEX__ID;
offset = address;
goto _errorFound;
}
info = &classfile->constantPool[name];
if (info->tag != CFR_CONSTANT_Utf8) {
errorCode = J9NLS_CFR_ERR_BAD_NAME_INDEX__ID;
offset = address;
goto _errorFound;
}
tag = attributeTagFor(info, (BOOLEAN) (flags & CFR_StripDebugAttributes));
switch (tag) {
case CFR_ATTRIBUTE_SourceFile:
if (sourceFileAttributeRead){
errorCode = J9NLS_CFR_ERR_FOUND_MULTIPLE_SOURCE_FILE_ATTRIBUTES__ID;
offset = address;
goto _errorFound;
}
sourceFileAttributeRead = TRUE;
if (!ALLOC_CAST(attrib, J9CfrAttributeSourceFile, J9CfrAttribute)) {
return -2;
}
CHECK_EOF(2);
NEXT_U16(((J9CfrAttributeSourceFile *) attrib)->sourceFileIndex, index);
break;
case CFR_ATTRIBUTE_Signature:
if (!ALLOC_CAST(attrib, J9CfrAttributeSignature, J9CfrAttribute)) {
return -2;
}
CHECK_EOF(2);
NEXT_U16(((J9CfrAttributeSignature *) attrib)->signatureIndex, index);
break;
case CFR_ATTRIBUTE_ConstantValue:
if (!ALLOC_CAST(attrib, J9CfrAttributeConstantValue, J9CfrAttribute)) {
return -2;
}
CHECK_EOF(2);
NEXT_U16(((J9CfrAttributeConstantValue *) attrib)->constantValueIndex, index);
break;
case CFR_ATTRIBUTE_Code:
if (!ALLOC(code, J9CfrAttributeCode)) {
return -2;
}
attrib = (J9CfrAttribute*)code;
CHECK_EOF(8);
NEXT_U16(code->maxStack, index);
NEXT_U16(code->maxLocals, index);
NEXT_U32(code->codeLength, index);
CHECK_EOF(code->codeLength);
if (!ALLOC_ARRAY(code->code, code->codeLength, U_8)) {
return -2;
}
code->originalCode = index;
memcpy (code->code, index, code->codeLength);
index += code->codeLength;
CHECK_EOF(2);
NEXT_U16(code->exceptionTableLength, index);
if (!ALLOC_ARRAY(code->exceptionTable, code->exceptionTableLength, J9CfrExceptionTableEntry)) {
return -2;
}
CHECK_EOF(code->exceptionTableLength << 3);
for (j = 0; j < code->exceptionTableLength; j++) {
exception = &(code->exceptionTable[j]);
NEXT_U16(exception->startPC, index);
NEXT_U16(exception->endPC, index);
NEXT_U16(exception->handlerPC, index);
NEXT_U16(exception->catchType, index);
}
CHECK_EOF(2);
NEXT_U16(code->attributesCount, index);
if (!ALLOC_ARRAY(code->attributes, code->attributesCount, J9CfrAttribute *)) {
return -2;
}
if ((result = readAttributes(classfile, &(code->attributes), code->attributesCount, data, dataEnd, segment, segmentEnd, &index, &freePointer, flags, NULL)) != 0) {
return result;
}
break;
case CFR_ATTRIBUTE_Exceptions:
if (!ALLOC(exceptions, J9CfrAttributeExceptions)) {
return -2;
}
attrib = (J9CfrAttribute*)exceptions;
CHECK_EOF(2);
NEXT_U16(exceptions->numberOfExceptions, index);
if (!ALLOC_ARRAY(exceptions->exceptionIndexTable, exceptions->numberOfExceptions, U_16)) {
return -2;
}
CHECK_EOF(exceptions->numberOfExceptions << 1);
for (j = 0; j < exceptions->numberOfExceptions; j++) {
NEXT_U16(exceptions->exceptionIndexTable[j], index);
}
break;
case CFR_ATTRIBUTE_LineNumberTable:
if (!ALLOC_CAST(attrib, J9CfrAttributeLineNumberTable, J9CfrAttribute)) {
return -2;
}
CHECK_EOF(2);
NEXT_U16(((J9CfrAttributeLineNumberTable *) attrib)->lineNumberTableLength, index);
if (!ALLOC_ARRAY(
((J9CfrAttributeLineNumberTable *) attrib)->lineNumberTable,
((J9CfrAttributeLineNumberTable *) attrib)->lineNumberTableLength,
J9CfrLineNumberTableEntry)) {
return -2;
}
CHECK_EOF(((J9CfrAttributeLineNumberTable *) attrib)->lineNumberTableLength << 2);
for (j = 0; j < ((J9CfrAttributeLineNumberTable *) attrib)->lineNumberTableLength; j++) {
NEXT_U16(((J9CfrAttributeLineNumberTable *) attrib)->lineNumberTable[j].startPC, index);
NEXT_U16(((J9CfrAttributeLineNumberTable *) attrib)->lineNumberTable[j].lineNumber, index);
}
break;
case CFR_ATTRIBUTE_LocalVariableTable:
if (!ALLOC_CAST(attrib, J9CfrAttributeLocalVariableTable, J9CfrAttribute)) {
return -2;
}
CHECK_EOF(2);
NEXT_U16(((J9CfrAttributeLocalVariableTable *) attrib)->localVariableTableLength, index);
if (!ALLOC_ARRAY(
((J9CfrAttributeLocalVariableTable *) attrib)->localVariableTable,
((J9CfrAttributeLocalVariableTable *) attrib)->localVariableTableLength,
J9CfrLocalVariableTableEntry)) {
return -2;
}
CHECK_EOF(((J9CfrAttributeLocalVariableTable *) attrib)->localVariableTableLength * 10);
for (j = 0; j < ((J9CfrAttributeLocalVariableTable *) attrib)->localVariableTableLength; j++) {
NEXT_U16(((J9CfrAttributeLocalVariableTable *) attrib)->localVariableTable[j].startPC, index);
NEXT_U16(((J9CfrAttributeLocalVariableTable *) attrib)->localVariableTable[j].length, index);
NEXT_U16(((J9CfrAttributeLocalVariableTable *) attrib)->localVariableTable[j].nameIndex, index);
NEXT_U16(((J9CfrAttributeLocalVariableTable *) attrib)->localVariableTable[j].descriptorIndex, index);
NEXT_U16(((J9CfrAttributeLocalVariableTable *) attrib)->localVariableTable[j].index, index);
}
break;
case CFR_ATTRIBUTE_LocalVariableTypeTable:
if (!ALLOC_CAST(attrib, J9CfrAttributeLocalVariableTypeTable, J9CfrAttribute)) {
return -2;
}
CHECK_EOF(2);
NEXT_U16(((J9CfrAttributeLocalVariableTypeTable *) attrib)->localVariableTypeTableLength, index);
if (!ALLOC_ARRAY(
((J9CfrAttributeLocalVariableTypeTable *) attrib)->localVariableTypeTable,
((J9CfrAttributeLocalVariableTypeTable *) attrib)->localVariableTypeTableLength,
J9CfrLocalVariableTypeTableEntry)) {
return -2;
}
CHECK_EOF(((J9CfrAttributeLocalVariableTypeTable *) attrib)->localVariableTypeTableLength * 10);
for (j = 0; j < ((J9CfrAttributeLocalVariableTypeTable *) attrib)->localVariableTypeTableLength; j++) {
NEXT_U16(((J9CfrAttributeLocalVariableTypeTable *) attrib)->localVariableTypeTable[j].startPC, index);
NEXT_U16(((J9CfrAttributeLocalVariableTypeTable *) attrib)->localVariableTypeTable[j].length, index);
NEXT_U16(((J9CfrAttributeLocalVariableTypeTable *) attrib)->localVariableTypeTable[j].nameIndex, index);
NEXT_U16(((J9CfrAttributeLocalVariableTypeTable *) attrib)->localVariableTypeTable[j].signatureIndex, index);
NEXT_U16(((J9CfrAttributeLocalVariableTypeTable *) attrib)->localVariableTypeTable[j].index, index);
}
break;
case CFR_ATTRIBUTE_Synthetic:
if (!ALLOC_CAST(attrib, J9CfrAttributeSynthetic, J9CfrAttribute)) {
return -2;
}
CHECK_EOF(length);
index += length;
if (NULL != syntheticFound) {
*syntheticFound = TRUE;
}
break;
case CFR_ATTRIBUTE_AnnotationDefault: {
if (annotationDefaultRead) {
/* found a redundant attribute */
errorCode = J9NLS_CFR_ERR_MULTIPLE_ANNOTATION_DEFAULT_ATTRIBUTES__ID;
offset = address;
goto _errorFound;
} else {
annotationDefaultRead = TRUE;
}
if (!ALLOC_CAST(attrib, J9CfrAttributeAnnotationDefault, J9CfrAttribute)) {
return -2;
}
result = readAnnotationElement(classfile, &((J9CfrAttributeAnnotationDefault *)attrib)->defaultValue,
data, dataEnd, segment, segmentEnd, &index, &freePointer, flags);
if (result != 0) {
return result;
}
}
break;
case CFR_ATTRIBUTE_RuntimeInvisibleAnnotations:
if (invisibleAnnotationsRead) {
/* found a redundant attribute */
errorCode = J9NLS_CFR_ERR_MULTIPLE_ANNOTATION_ATTRIBUTES__ID;
offset = address;
goto _errorFound;
} else {
invisibleAnnotationsRead = TRUE;
}
if (J9_ARE_NO_BITS_SET(flags, BCT_RetainRuntimeInvisibleAttributes)) {
if (!ALLOC(attrib, J9CfrAttribute)) { /* create dummy attribute and skip */
return BCT_ERR_OUT_OF_ROM;
}
CHECK_EOF(length);
index += length;
break;
} /* else FALLTHROUGH */
case CFR_ATTRIBUTE_RuntimeVisibleAnnotations: {
U_8 *attributeStart = index;
J9CfrAttributeRuntimeVisibleAnnotations *annotations = NULL;
if (CFR_ATTRIBUTE_RuntimeVisibleAnnotations == tag) {
if (visibleAnnotationsRead) {
/* found a redundant attribute */
errorCode = J9NLS_CFR_ERR_MULTIPLE_ANNOTATION_ATTRIBUTES__ID;
offset = address;
goto _errorFound;
}
visibleAnnotationsRead = TRUE;
}
if (!ALLOC_CAST(attrib, J9CfrAttributeRuntimeVisibleAnnotations, J9CfrAttribute)) {
return BCT_ERR_OUT_OF_ROM;
}
annotations = (J9CfrAttributeRuntimeVisibleAnnotations *)attrib;
annotations->numberOfAnnotations = 0;
annotations->annotations = NULL;
annotations->rawAttributeData = NULL;
annotations->rawDataLength = 0; /* 0 indicates attribute is well-formed */
/* In the case of a malformed attribute numberOfAnnotations may not exist even if the file did not end.
* There must be at least two bytes to have a valid numberOfAnnotations.
* Length of 0 will be treated as an error below. Length of 1 will be an error as well since the index
* will not match the end value.
*/
if (length > 1) {
CHECK_EOF(2);
NEXT_U16(annotations->numberOfAnnotations, index);
if (!ALLOC_ARRAY(annotations->annotations, annotations->numberOfAnnotations, J9CfrAnnotation)) {
return BCT_ERR_OUT_OF_ROM;
}
result = readAnnotations(classfile, annotations->annotations, annotations->numberOfAnnotations, data, dataEnd, segment, segmentEnd, &index, &freePointer, flags);
}
if (BCT_ERR_OUT_OF_ROM == result) {
/* Return out of memory error code to allocate larger buffer for classfile */
return result;
} else if ((BCT_ERR_NO_ERROR != result) || (0 == length) || (index != end)) {
U_32 cursor = 0;
Trc_BCU_MalformedAnnotation(address);
/* Capture the errors with type_name_index & const_name_index in enum_const_value against the VM Spec */
if (BCT_ERR_INVALID_ANNOTATION_BAD_CP_INDEX_OUT_OF_RANGE == result) {
errorCode = J9NLS_CFR_ERR_BAD_INDEX__ID;
offset = address;
goto _errorFound;
} else if (BCT_ERR_INVALID_ANNOTATION_BAD_CP_UTF8_STRING == result) {
errorCode = J9NLS_CFR_ERR_BAD_NAME_INDEX__ID;
offset = address;
goto _errorFound;
}
if (0 == length) {
/* rawDataLength should be zero to indicate an error. Add an extra byte to the annotation
* to indicate an error. This case will not be common. */
annotations->rawDataLength = 1;
if (!ALLOC_ARRAY(annotations->rawAttributeData, 1, U_8)) {
return BCT_ERR_OUT_OF_ROM;
}
annotations->rawAttributeData[0] = 0;
} else {
annotations->rawDataLength = length;
if (!ALLOC_ARRAY(annotations->rawAttributeData, length, U_8)) {
return BCT_ERR_OUT_OF_ROM;
}
index = attributeStart; /* rewind to the start of the attribute */
for (cursor = 0; cursor < annotations->rawDataLength; ++cursor) {
CHECK_EOF(1);
NEXT_U8(annotations->rawAttributeData[cursor], index);
}
}
}
}
break;
case CFR_ATTRIBUTE_MethodParameters:
if (!ALLOC_CAST(attrib, J9CfrAttributeMethodParameters, J9CfrAttribute)) {
return -2;
}
CHECK_EOF(1);
NEXT_U8(((J9CfrAttributeMethodParameters *) attrib)->numberOfMethodParameters, index);
if (!ALLOC_ARRAY(
((J9CfrAttributeMethodParameters *) attrib)->methodParametersIndexTable,
((J9CfrAttributeMethodParameters *) attrib)->numberOfMethodParameters,
U_16)) {
return -2;
}
if (!ALLOC_ARRAY(
((J9CfrAttributeMethodParameters *) attrib)->flags,
((J9CfrAttributeMethodParameters *) attrib)->numberOfMethodParameters,
U_16)) {
return -2;
}
/* We need 4 bytes for each methodParameter (2 for flags, 2 formethodParametersIndexTable ) */
CHECK_EOF(((J9CfrAttributeMethodParameters *) attrib)->numberOfMethodParameters * 4);
for (j = 0; j < ((J9CfrAttributeMethodParameters *) attrib)->numberOfMethodParameters; j++) {
NEXT_U16(((J9CfrAttributeMethodParameters *) attrib)->methodParametersIndexTable[j], index);
NEXT_U16(((J9CfrAttributeMethodParameters *) attrib)->flags[j], index);
}
break;
case CFR_ATTRIBUTE_RuntimeInvisibleParameterAnnotations:
if (invisibleParameterAnnotationsRead) {
/* found a redundant attribute */
errorCode = J9NLS_CFR_ERR_MULTIPLE_PARAMETER_ANNOTATION_ATTRIBUTES__ID;
offset = address;
goto _errorFound;
} else {
invisibleParameterAnnotationsRead = TRUE;
}
if (J9_ARE_NO_BITS_SET(flags, BCT_RetainRuntimeInvisibleAttributes)) {
if (!ALLOC(attrib, J9CfrAttribute)) { /* create dummy attribute and skip */
return -2;
}
CHECK_EOF(length);
index += length;
break;
} /* else FALLTHROUGH */
case CFR_ATTRIBUTE_RuntimeVisibleParameterAnnotations: {
U_8 *attributeStart = index;
J9CfrAttributeRuntimeVisibleParameterAnnotations *annotations = NULL;
if (CFR_ATTRIBUTE_RuntimeVisibleParameterAnnotations == tag) {
if (visibleParameterAnnotationsRead) {
/* found a redundant attribute */
errorCode = J9NLS_CFR_ERR_MULTIPLE_PARAMETER_ANNOTATION_ATTRIBUTES__ID;
offset = address;
goto _errorFound;
}
visibleParameterAnnotationsRead = TRUE;
}
if (!ALLOC_CAST(attrib, J9CfrAttributeRuntimeVisibleParameterAnnotations, J9CfrAttribute)) {
return -2;
}
annotations = (J9CfrAttributeRuntimeVisibleParameterAnnotations *)attrib;
annotations->rawAttributeData = NULL;
annotations->rawDataLength = 0; /* 0 indicates attribute is well-formed */
CHECK_EOF(1);
NEXT_U8(annotations->numberOfParameters, index);
if (!ALLOC_ARRAY(annotations->parameterAnnotations, annotations->numberOfParameters, J9CfrParameterAnnotations)) {
return -2;
}
parameterAnnotations = annotations->parameterAnnotations;
for (j = 0; j < annotations->numberOfParameters; j++, parameterAnnotations++) {
CHECK_EOF(2);
NEXT_U16(parameterAnnotations->numberOfAnnotations, index);
if (!ALLOC_ARRAY(parameterAnnotations->annotations, parameterAnnotations->numberOfAnnotations, J9CfrAnnotation)) {
return -2;
}
result = readAnnotations(classfile, parameterAnnotations->annotations, parameterAnnotations->numberOfAnnotations, data, dataEnd,
segment, segmentEnd, &index, &freePointer, flags);
if (BCT_ERR_NO_ERROR != result) {
break;
}
}
/* Jazz 104170: According to Java SE 8V M Spec at 4.7.18 The RuntimeVisibleParameterAnnotations Attribute:
* num_parameters == 0 means there is no parameter for this method and naturally no annotations
* for these parameters, in which case the code should treat this attribute as bad and ignore it.
*/
if (BCT_ERR_OUT_OF_ROM == result) {
/* Return out of memory error code to allocate larger buffer for classfile */
return result;
} else if ((BCT_ERR_NO_ERROR != result) || (index != end) || (0 == annotations->numberOfParameters)) {
U_32 cursor = 0;
/*
* give up parsing.
* Copy the raw data, a 0 where the num_parameters should be, followed by the rest of the data.
* This is forces an error because if num_parameters=0, there should be no more data in the attribute.
*/
Trc_BCU_MalformedParameterAnnotation(address);
if (!ALLOC_ARRAY(annotations->rawAttributeData, length + 1, U_8)) {
return -2;
}
index = attributeStart; /* rewind to the start of the attribute */
NEXT_U8(annotations->rawAttributeData[0], index); /* put in the num_parameters */
if (0 != annotations->rawAttributeData[0]) {
/* insert an error marker */
annotations->rawAttributeData[1] = annotations->rawAttributeData[0];
annotations->rawAttributeData[0] = 0;
annotations->rawDataLength = length + 1;
} else { /* the attribute is already marked bad */
if (length > 1) {
NEXT_U8(annotations->rawAttributeData[1], index);
}
annotations->rawDataLength = length;
}
/* Jazz 104170: Given that annotations->rawAttributeData[0] is set to 0
* in the case of malformed annotation attribute, we should also
* set num_parameters to 0 so as to skip this attribute when
* walking through attributes in ClassFileOracle::walkMethodAttributes().
*/
annotations->numberOfParameters = annotations->rawAttributeData[0];
for (cursor = 2; cursor < annotations->rawDataLength; ++cursor) {
CHECK_EOF(1);
NEXT_U8(annotations->rawAttributeData[cursor], index);
}
}
}
break;
case CFR_ATTRIBUTE_RuntimeInvisibleTypeAnnotations: {
if (invisibleTypeAttributeRead) {
/* found a second typeAnnotation attribute */
errorCode = J9NLS_CFR_ERR_MULTIPLE_TYPE_ANNOTATIONS_ATTRIBUTES__ID;
offset = address;
goto _errorFound;
}
invisibleTypeAttributeRead = TRUE;
if (J9_ARE_NO_BITS_SET(flags, BCT_RetainRuntimeInvisibleAttributes)) {
if (!ALLOC(attrib, J9CfrAttribute)) { /* create dummy attribute and skip */
return -2;
}
CHECK_EOF(length);
index += length;
break;
} /* else FALLTHROUGH */
}
case CFR_ATTRIBUTE_RuntimeVisibleTypeAnnotations: {
J9CfrAttributeRuntimeVisibleTypeAnnotations *annotations = NULL;
U_8 *attributeStart = index;
BOOLEAN foundError = FALSE;
{
if (CFR_ATTRIBUTE_RuntimeVisibleTypeAnnotations == tag) {
if (visibleTypeAttributeRead) {
/* found a second typeAnnotation attribute */
errorCode = J9NLS_CFR_ERR_MULTIPLE_TYPE_ANNOTATIONS_ATTRIBUTES__ID;
offset = address;
goto _errorFound;
}
visibleTypeAttributeRead = TRUE;
}
}
if (!ALLOC_CAST(attrib, J9CfrAttributeRuntimeVisibleTypeAnnotations, J9CfrAttribute)) {
return -2;
}
annotations = (J9CfrAttributeRuntimeVisibleTypeAnnotations *)attrib;
annotations->numberOfAnnotations = 0;
annotations->typeAnnotations = NULL;
annotations->rawAttributeData = NULL;
annotations->rawDataLength = 0; /* 0 indicates attribute is well-formed */
/* In the case of a malformed attribute numberOfAnnotations may not exist even if the file did not end.
* There must be at least two bytes to have a valid numberOfAnnotations.
* Length of 0 will be treated as an error below. Length of 1 will be an error as well since the index
* will not match the end value.
*/
if (length > 1) {
CHECK_EOF(2);
NEXT_U16(annotations->numberOfAnnotations, index);
if (!ALLOC_ARRAY(annotations->typeAnnotations, annotations->numberOfAnnotations, J9CfrTypeAnnotation)) {
return -2;
}
typeAnnotations = annotations->typeAnnotations;
/*
* we are now at the start of the first type_annotation
* Silently ignore errors.
*/
for (j = 0; j < annotations->numberOfAnnotations; j++, typeAnnotations++) {
result = readTypeAnnotation(classfile, typeAnnotations, data, dataEnd, segment, segmentEnd, &index, &freePointer, flags);
if (BCT_ERR_NO_ERROR != result) {
break;
}
}
}
if (BCT_ERR_OUT_OF_ROM == result) {
/* Return out of memory error code to allocate larger buffer for classfile */
return result;
} else if ((BCT_ERR_NO_ERROR != result) || (0 == length) || (index != end)) {
/*
* Give up parsing.
*
* Copy the raw data, insert a bogus type_annotation,
* i.e. an illegal target_type byte immediately after the num_annotations field
* to indicate that the attribute is malformed. The remaining raw data should follow
* the illegal target_type.
*
* The minimum number of raw data bytes needed to create a bogus type_annotation is:
* num_annotations (2 bytes)
* target_type (1 byte)
* extra raw data (at least 1 byte)
*
* Length will be adjusted during rawAttributeData assignment if it is determined that
* an extra slot is not needed.
*/
const U_32 minimumRawDataBytes = 4;
Trc_BCU_MalformedTypeAnnotation(address);
annotations->rawDataLength = OMR_MAX(minimumRawDataBytes, length + 1);
if (!ALLOC_ARRAY(annotations->rawAttributeData, annotations->rawDataLength, U_8)) {
return -2;
}
index = attributeStart; /* rewind to the start of the attribute */
/* read num_annotations or set dummy if these bytes do not exist. */
if (length >= 2) {
NEXT_U16(annotations->rawAttributeData[0], index);
} else {
/* there should be at least one type_annotation here for the illegal
* entry that is being created. */
annotations->rawAttributeData[0] = 0;
annotations->rawAttributeData[1] = 1;
}
/* Insert illegal target_type followed by remaining raw data. */
if (index == end) {
/* There is no remaining raw data. */
annotations->rawAttributeData[2] = CFR_TARGET_TYPE_ErrorInAttribute;
/* Adjust rawDataLength since there was no need to insert an extra byte. */
annotations->rawDataLength -= 1;
} else {
/* cursor is the starting point in raw data array to write remaining raw data. */
U_32 cursor = 0;
NEXT_U8(annotations->rawAttributeData[2], index);
if (CFR_TARGET_TYPE_ErrorInAttribute != annotations->rawAttributeData[2]) {
/* insert an error marker */
annotations->rawAttributeData[3] = annotations->rawAttributeData[2];
annotations->rawAttributeData[2] = CFR_TARGET_TYPE_ErrorInAttribute;
cursor = 4;
} else {
/* The attribute is already marked bad.
* Adjust rawDataLength since there was no need to insert an extra byte.
*/
annotations->rawDataLength -= 1;
cursor = 3;
}
while (index != end) {
CHECK_EOF(1);
NEXT_U8(annotations->rawAttributeData[cursor], index);
cursor++;
}
}
}
result = 0;
}
break;
case CFR_ATTRIBUTE_InnerClasses:
if (!ALLOC(classes, J9CfrAttributeInnerClasses)) {
return -2;
}
attrib = (J9CfrAttribute*)classes;
CHECK_EOF(2);
NEXT_U16(classes->numberOfClasses, index);
if (!ALLOC_ARRAY(classes->classes, classes->numberOfClasses, J9CfrClassesEntry)) {
return -2;
}
CHECK_EOF(classes->numberOfClasses << 3);
for (j = 0; j < classes->numberOfClasses; j++) {
NEXT_U16(classes->classes[j].innerClassInfoIndex, index);
NEXT_U16(classes->classes[j].outerClassInfoIndex, index);
NEXT_U16(classes->classes[j].innerNameIndex, index);
NEXT_U16(classes->classes[j].innerClassAccessFlags, index);
}
break;
case CFR_ATTRIBUTE_BootstrapMethods:
if (bootstrapMethodAttributeRead) {
errorCode = J9NLS_CFR_ERR_FOUND_MULTIPLE_BOOTSTRAP_METHODS_ATTRIBUTES__ID;
offset = address;
goto _errorFound;
}
bootstrapMethodAttributeRead = TRUE;
if (!ALLOC(bootstrapMethods, J9CfrAttributeBootstrapMethods)) {
return -2;
}
attrib = (J9CfrAttribute*)bootstrapMethods;
CHECK_EOF(2);
NEXT_U16(bootstrapMethods->numberOfBootstrapMethods, index);
if (!ALLOC_ARRAY(bootstrapMethods->bootstrapMethods, bootstrapMethods->numberOfBootstrapMethods, J9CfrBootstrapMethod)) {
return -2;
}
for (j = 0; j < bootstrapMethods->numberOfBootstrapMethods; j++) {
CHECK_EOF(4);
NEXT_U16(bootstrapMethods->bootstrapMethods[j].bootstrapMethodIndex, index);
NEXT_U16(bootstrapMethods->bootstrapMethods[j].numberOfBootstrapArguments, index);
if (!ALLOC_ARRAY(bootstrapMethods->bootstrapMethods[j].bootstrapArguments, bootstrapMethods->bootstrapMethods[j].numberOfBootstrapArguments, U_16)) {
return -2;
}
CHECK_EOF(bootstrapMethods->bootstrapMethods[j].numberOfBootstrapArguments << 1);
for (k = 0; k < bootstrapMethods->bootstrapMethods[j].numberOfBootstrapArguments; k++) {
NEXT_U16(bootstrapMethods->bootstrapMethods[j].bootstrapArguments[k], index);
}
}
break;
case CFR_ATTRIBUTE_EnclosingMethod:
if (!ALLOC_CAST(attrib, J9CfrAttributeEnclosingMethod, J9CfrAttribute)) {
return -2;
}
CHECK_EOF(4);
NEXT_U16(((J9CfrAttributeEnclosingMethod *) attrib)->classIndex, index);
NEXT_U16(((J9CfrAttributeEnclosingMethod *) attrib)->methodIndex, index);
break;
case CFR_ATTRIBUTE_Deprecated:
if (!ALLOC_CAST(attrib, J9CfrAttributeDeprecated, J9CfrAttribute)) {
return -2;
}
CHECK_EOF(length);
index += length;
break;
case CFR_ATTRIBUTE_StackMapTable:
if (!ALLOC(stackMap, J9CfrAttributeStackMap)) {
return -2;
}
attrib = (J9CfrAttribute *)stackMap;
CHECK_EOF(2);
NEXT_U16(stackMap->numberOfEntries, index);
stackMap->mapLength = 0;
if (length > 1) {
stackMap->mapLength = length - 2;
}
if (!ALLOC_ARRAY(stackMap->entries, stackMap->mapLength, U_8)) {
return -2;
}
CHECK_EOF(stackMap->mapLength);
memcpy (stackMap->entries, index, stackMap->mapLength);
index += stackMap->mapLength;
break;
case CFR_ATTRIBUTE_Record:
/* JVMS 4.7.30: There may be at most one Record attribute in the attributes table of a ClassFile structure. */
if (recordAttributeRead){
errorCode = J9NLS_CFR_ERR_MULTIPLE_RECORD_ATTRIBUTES__ID;
offset = address;
goto _errorFound;
}
recordAttributeRead = TRUE;
/* set classfile flag for record class (used by cfdumper) */
classfile->j9Flags |= CFR_J9FLAG_IS_RECORD;
if (!ALLOC(record, J9CfrAttributeRecord)) {
return -2;
}
attrib = (J9CfrAttribute*)record;
CHECK_EOF(2);
NEXT_U16(record->numberOfRecordComponents, index);
if (!ALLOC_ARRAY(record->recordComponents, record->numberOfRecordComponents, J9CfrRecordComponent)) {
return -2;
}
for (j = 0; j < record->numberOfRecordComponents; j++) {
J9CfrRecordComponent* recordComponent = &(record->recordComponents[j]);
CHECK_EOF(6);
NEXT_U16(recordComponent->nameIndex, index);
NEXT_U16(recordComponent->descriptorIndex, index);
NEXT_U16(recordComponent->attributesCount, index);
if (!ALLOC_ARRAY(recordComponent->attributes, recordComponent->attributesCount, J9CfrAttribute *)) {
return -2;
}
result = readAttributes(classfile, &(recordComponent->attributes), recordComponent->attributesCount, data, dataEnd, segment, segmentEnd, &index, &freePointer, flags, NULL);
if (result != 0) {
return result;
}
}
break;
case CFR_ATTRIBUTE_PermittedSubclasses:
/* JVMS: There may be at most one PermittedSubclasses attribute in the attributes table of a ClassFile structure... */
if (permittedSubclassesAttributeRead) {
errorCode = J9NLS_CFR_ERR_MULTIPLE_PERMITTEDSUBCLASSES_ATTRIBUTES__ID;
offset = address;
goto _errorFound;
}
permittedSubclassesAttributeRead = TRUE;
/* set classfile flag for sealed class (used by cfdumper) */
classfile->j9Flags |= CFR_J9FLAG_IS_SEALED;
if (!ALLOC(permittedSubclasses, J9CfrAttributePermittedSubclasses)) {
return -2;
}
attrib = (J9CfrAttribute*)permittedSubclasses;
CHECK_EOF(2);
NEXT_U16(permittedSubclasses->numberOfClasses, index);
if (!ALLOC_ARRAY(permittedSubclasses->classes, permittedSubclasses->numberOfClasses, U_16)) {
return -2;
}
for (j = 0; j < permittedSubclasses->numberOfClasses; j++) {
CHECK_EOF(2);
NEXT_U16(permittedSubclasses->classes[j], index);
}
break;
#if defined(J9VM_OPT_VALHALLA_VALUE_TYPES)
case CFR_ATTRIBUTE_LoadableDescriptors:
/* JVMS: There may be at most one LoadableDescriptors attribute
* in the attributes table of a ClassFile structure...
*/
if (loadableDescriptorsAttributeRead) {
errorCode = J9NLS_CFR_ERR_MULTIPLE_LOADABLEDESCRIPTORS_ATTRIBUTES__ID;
offset = address;
goto _errorFound;
}
loadableDescriptorsAttributeRead = TRUE;
if (!ALLOC(loadableDescriptors, J9CfrAttributeLoadableDescriptors)) {
return -2;
}
attrib = (J9CfrAttribute *)loadableDescriptors;
CHECK_EOF(2);
NEXT_U16(loadableDescriptors->numberOfDescriptors, index);
if (!ALLOC_ARRAY(loadableDescriptors->descriptors, loadableDescriptors->numberOfDescriptors, U_16)) {
return -2;
}
for (j = 0; j < loadableDescriptors->numberOfDescriptors; j++) {
CHECK_EOF(2);
NEXT_U16(loadableDescriptors->descriptors[j], index);
}
break;
#endif /* defined(J9VM_OPT_VALHALLA_VALUE_TYPES) */
#if defined(J9VM_OPT_VALHALLA_FLATTENABLE_VALUE_TYPES)
case CFR_ATTRIBUTE_ImplicitCreation:
/* JVMS: There may be at most one ImplicitCreation attribute in the attributes table of a ClassFile structure... */
if (implicitCreationAttributeRead) {
errorCode = J9NLS_CFR_ERR_MULTIPLE_IMPLICITCREATION_ATTRIBUTES__ID;
offset = address;
goto _errorFound;
}
implicitCreationAttributeRead = TRUE;
if (!ALLOC(implicitCreation, J9CfrAttributeImplicitCreation)) {
return -2;
}
attrib = (J9CfrAttribute*)implicitCreation;
CHECK_EOF(2);
NEXT_U16(implicitCreation->implicitCreationFlags, index);
break;
case CFR_ATTRIBUTE_NullRestricted:
/* JVMS: There must be no more than one NullRestricted attribute in the attributes table of a field_info structure */
if (nullRestrictedAttributeRead) {
errorCode = J9NLS_CFR_ERR_MULTIPLE_NULLRESTRICTED_ATTRIBUTES__ID;
offset = address;
goto _errorFound;
}
nullRestrictedAttributeRead = TRUE;
if (!ALLOC_CAST(attrib, J9CfrAttributeNullRestricted, J9CfrAttribute)) {
return -2;
}
if (length != 0) {
errorCode = J9NLS_CFR_ERR_NULLRESTRICTED_ATTRIBUTES_LENGTH_IS_ZERO__ID;
}
break;
#endif /* defined(J9VM_OPT_VALHALLA_FLATTENABLE_VALUE_TYPES) */