{"record":{"id":"1c7d6cc1bf480b31","repo":"oracle/graal","slug":"array-with-more-than-255-dimensions","errorCode":null,"errorMessage":"Array with more than 255 dimensions {}","messagePattern":"Array with more than 255 dimensions (.+?)","errorType":"exception","errorClass":"ParserException.ClassFormatError","httpStatus":null,"severity":"error","filePath":"espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/descriptors/TypeSymbols.java","lineNumber":239,"sourceCode":"            return beginIndex + 1;\n        }\n        switch (ch) {\n            case 'L': {\n                final int endIndex = skipClassName(descriptor, beginIndex + 1, slashes ? '/' : '.');\n                if (endIndex > beginIndex + 1 && endIndex < descriptor.length() && descriptor.byteAt(endIndex) == ';') {\n                    return endIndex + 1;\n                }\n                throw new ParserException.ClassFormatError(\"Invalid Java name \" + descriptor.subSequence(beginIndex));\n            }\n            case '[': {\n                // compute the number of dimensions\n                int index = beginIndex;\n                while (index < descriptor.length() && descriptor.byteAt(index) == '[') {\n                    index++;\n                }\n                final int dimensions = index - beginIndex;\n                if (dimensions > 255) {\n                    throw new ParserException.ClassFormatError(\"Array with more than 255 dimensions \" + descriptor.subSequence(beginIndex));\n                }\n                return skipValidTypeDescriptor(descriptor, index, slashes);\n            }\n        }\n        throw new ParserException.ClassFormatError(\"Invalid type descriptor \" + descriptor.subSequence(beginIndex));\n    }\n\n    /**\n     * Gets the type descriptor for the specified component type descriptor with the specified\n     * number of dimensions. For example if the number of dimensions is 1, then this method will\n     * return a descriptor for an array of the component type; if the number of dimensions is 2, it\n     * will return a descriptor for an array of an array of the component type, etc.\n     *\n     * @param type the type descriptor for the component type of the array\n     * @param dimensions the number of array dimensions\n     * @return the canonical type descriptor for the specified component type and dimensions\n     */\n    public Symbol<Type> arrayOf(Symbol<Type> type, int dimensions) {","sourceCodeStart":221,"sourceCodeEnd":257,"githubUrl":"https://github.com/oracle/graal/blob/a66e9ccd1d7bf2552883939aa0788dfd0e294aab/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/descriptors/TypeSymbols.java#L221-L257","documentation":"For array descriptors, skipValidTypeDescriptor counts leading '[' characters; the JVM spec limits arrays to 255 dimensions. More than 255 consecutive '[' throws ParserException.ClassFormatError 'Array with more than 255 dimensions <rest-of-descriptor>' before recursing into the element type.","triggerScenarios":"Descriptors with 256+ leading '[' — usually produced by a loop that prepends '[' per array nesting level (e.g. recursive type mapping) or by a generator bug adding dimensions each iteration.","commonSituations":"Recursive generic array conversion where each recursion adds a dimension; fuzzed/malformed class files; copy loops that never terminate but append '[' each pass.","solutions":["Cap array nesting in your generator at 255 dimensions and assert on it","Fix the recursive loop that keeps adding dimensions (usually a missing termination condition)","Validate incoming descriptors with a dimension count check before parsing"],"exampleFix":"// before\nwhile (someCondition) { desc = \"[\" + desc; } // unbounded\n\n// after\nint dims = 0;\nwhile (someCondition && dims < 255) { desc = \"[\" + desc; dims++; }","handlingStrategy":"validation","validationCode":"int dims = 0; while (dims < desc.length() && desc.charAt(dims) == '[') dims++;\nif (dims > 255) throw new IllegalArgumentException(\"Array dimensions \" + dims + \" exceed 255: \" + desc);","typeGuard":"static boolean dimensionCountOk(String d) { int n = 0; while (n < d.length() && d.charAt(n) == '[') n++; return n <= 255; }","tryCatchPattern":"catch (ParserException.ClassFormatError e) { report dimension count and cap recursion in the generator }","preventionTips":["Bound any dimension-adding loop at 255","Suspect runaway recursion whenever deeply nested '[' appear in generated descriptors"],"tags":["espresso","classfile","descriptor","array","parsing"],"backgroundTag":null,"analyzedSha":"a66e9ccd1d7bf2552883939aa0788dfd0e294aab","analyzedAt":"2026-08-14T13:58:47.161Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}