{"record":{"id":"9bd7f675d325ca63","repo":"pxb1988/dex2jar","slug":"invalid-extended-opcode-encountered","errorCode":null,"errorMessage":"Invalid extended opcode encountered ","messagePattern":"Invalid extended opcode encountered ","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"dex-reader/src/main/java/com/googlecode/d2j/reader/DexFileReader.java","lineNumber":569,"sourceCode":"            case DBG_ADVANCE_LINE:\r\n                line += readLeb128i(in);\r\n                break;\r\n\r\n            case DBG_SET_PROLOGUE_END:\r\n                order(labelMap, address);\r\n                dcv.visitPrologue(labelMap.get(address));\r\n                break;\r\n            case DBG_SET_EPILOGUE_BEGIN:\r\n                order(labelMap, address);\r\n                dcv.visitEpiogue(labelMap.get(address));\r\n                break;\r\n            case DBG_SET_FILE:\r\n                // skip\r\n                break;\r\n\r\n            default:\r\n                if (opcode < DBG_FIRST_SPECIAL) {\r\n                    throw new RuntimeException(\"Invalid extended opcode encountered \" + opcode);\r\n                }\r\n\r\n                int adjopcode = opcode - DBG_FIRST_SPECIAL;\r\n\r\n                address += adjopcode / DBG_LINE_RANGE;\r\n                line += DBG_LINE_BASE + (adjopcode % DBG_LINE_RANGE);\r\n\r\n                order(labelMap, address);\r\n                dcv.visitLineNumber(line, labelMap.get(address));\r\n                break;\r\n\r\n            }\r\n        }\r\n    }\r\n\r\n    @Override\r\n    public int getDexVersion() {\r\n        return dex_version;\r","sourceCodeStart":551,"sourceCodeEnd":587,"githubUrl":"https://github.com/pxb1988/dex2jar/blob/b5bda4fb4935ae8b3869b422454ae3b3896c7bc1/dex-reader/src/main/java/com/googlecode/d2j/reader/DexFileReader.java#L551-L587","documentation":"The debug info opcode decoder hit an extended (0x09-prefixed) opcode it does not recognize, and the value is also below DBG_FIRST_SPECIAL, so there is no special-opcode fallback. The reader throws a RuntimeException because the debug state machine cannot interpret the opcode. This signals a corrupt or non-standard debug_info_item.","triggerScenarios":"A debug_info stream containing an unknown extended opcode < DBG_FIRST_SPECIAL (0x0a) in the default case of the switch — corrupted dex, truncated debug data, or a dex from a tool emitting opcodes outside the spec's DBG_END_SEQUENCE..DBG_SET_FILE range.","commonSituations":"Partially corrupted files (one byte flipped inside debug data); research dex generated by custom writers; old/odd toolchains emitting unexpected debug opcodes; dex2jar conversions of such files.","solutions":["Rebuild the dex from sources with standard tooling to regenerate valid debug info","Strip debug info (dx --no-debug-info / d8 --no-debug-info) to avoid decoding the debug stream at all","Hexdump and repair the debug_info_item containing the bad opcode","Patch the reader's default case to skip unknown opcodes if you must process untrusted inputs"],"exampleFix":"// before\n// DexFileReader.accept(reader) on a corrupted dex -> RuntimeException\n// after: strip debug info at build time\n// d8 --release --no-debug-info --output out/ input.jar","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n    new DexFileReader(file).accept(visitor);\n} catch (RuntimeException e) {\n    if (e.getMessage() != null && e.getMessage().startsWith(\"Invalid extended opcode encountered\")) {\n        return retryWithoutDebugInfo(file); // rebuild/strip debug info and retry\n    }\n    throw e;\n}","preventionTips":["Verify dex integrity (header checksum) before parsing — a single corrupted byte can produce unknown opcodes","Strip debug info with --no-debug-info for untrusted inputs","Regenerate dex with standard toolchains rather than parsing hand-written debug data"],"tags":["dex","debug-info","opcode"],"backgroundTag":"invalid-enum-value","analyzedSha":"b5bda4fb4935ae8b3869b422454ae3b3896c7bc1","analyzedAt":"2026-09-08T00:44:01.258Z","contentChangedAt":"2026-09-08T00:44:01.258Z","schemaVersion":2},"datasetVersion":"2026-09-16T09:17:16.951Z"}