{"record":{"id":"bc94c3a39f599ef8","repo":"oracle/graal","slug":"malformed-hexcodefile-in-bc94c3","errorCode":null,"errorMessage":"Malformed HexCodeFile in ","messagePattern":"Malformed HexCodeFile in ","errorType":"exception","errorClass":"InternalError","httpStatus":null,"severity":"error","filePath":"compiler/src/jdk.graal.compiler.test/src/jdk/graal/compiler/disassembler/HexCodeFileDis.java","lineNumber":103,"sourceCode":"            int codeStart = index + startDelim.length();\n\n            String copy = input.substring(codeEnd, codeStart);\n            if (copy.startsWith(endDelim)) {\n                copy = copy.substring(endDelim.length());\n            }\n            if (copy.endsWith(startDelim)) {\n                copy = copy.substring(0, copy.length() - startDelim.length());\n            }\n            out.println(copy);\n\n            int endIndex = input.indexOf(endDelim, codeStart);\n            assert endIndex != -1;\n\n            String source = input.substring(codeStart, endIndex);\n\n            HexCodeFile hcf = HexCodeFile.parse(input, codeStart, source, inputName);\n            if (hcf == null) {\n                throw new InternalError(\"Malformed HexCodeFile in \" + inputName);\n            }\n            process(hcf, out);\n            hcfCount++;\n            codeEnd = endIndex;\n        }\n\n        String copy = input.substring(codeEnd);\n        if (copy.startsWith(endDelim)) {\n            copy = copy.substring(endDelim.length());\n        }\n\n        System.out.println(inputName + \": disassembled \" + hcfCount + \" embedded HexCodeFiles\");\n        out.print(copy);\n        out.flush();\n        return baos.toString();\n    }\n\n    /**","sourceCodeStart":85,"sourceCodeEnd":121,"githubUrl":"https://github.com/oracle/graal/blob/a66e9ccd1d7bf2552883939aa0788dfd0e294aab/compiler/src/jdk.graal.compiler.test/src/jdk/graal/compiler/disassembler/HexCodeFileDis.java#L85-L121","documentation":"HexCodeFileDis throws this InternalError when HexCodeFile.parse returns null for an embedded code block it extracted from a larger document. Like the DisassemblerTool variant, it means the text between the start/end delimiters failed HexCodeFile parsing; the InternalError (vs IllegalArgumentException) signals it fires inside the library's own processing loop rather than at a CLI boundary. The named input file identifies which document contained the bad block.","triggerScenarios":"Calling the HexCodeFileDis processing API on a file where an embedded block (between startDelim and endDelim) has malformed hex content, inconsistent comment columns, or where an assert-protected indexOf(endDelim) region ends up containing unparseable text. hcf == null from HexCodeFile.parse triggers the throw.","commonSituations":"Batch-disassembling compiler test output or hs_err-style logs that contain embedded hex code sections; a single corrupt or foreign-format block aborts the whole run. Version skew between the producer of the dump and this parser, or hand-merged log files, are typical causes.","solutions":["Locate the offending block in the named file (search for the start delimiter) and fix or delete the malformed lines.","Reproduce with DisassemblerTool on the same file to see which block index fails, then isolate it.","Regenerate the dump with the same GraalVM version as the disassembler library.","If processing many files, wrap per-file processing so one bad block does not stop the batch."],"exampleFix":"// before\nnew HexCodeFileDis(showComments, showBytes).processFile(corruptFile);\n// after (batch hardening)\nfor (Path f : files) {\n    try {\n        new HexCodeFileDis(showComments, showBytes).processFile(f);\n    } catch (InternalError e) {\n        System.err.println(\"skipping \" + f + \": \" + e.getMessage());\n    }\n}","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"for (Path f : files) {\n    try { new HexCodeFileDis(false, false).process(f.toFile()); }\n    catch (InternalError e) { log.warning(\"skipping \" + f + \": \" + e.getMessage()); }\n}","preventionTips":["Per-file try/catch when disassembling batches of logs.","Keep producer and parser GraalVM versions matched.","Check delimiter balance in generated logs before feeding them back in."],"tags":["graalvm","disassembler","hexcodefile","parsing"],"backgroundTag":null,"analyzedSha":"a66e9ccd1d7bf2552883939aa0788dfd0e294aab","analyzedAt":"2026-08-14T13:58:47.161Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}