{"record":{"id":"5b227dd7195c62c2","repo":"pxb1988/dex2jar","slug":"bbbbbbbb","errorCode":null,"errorMessage":"#+BBBBBBBB","messagePattern":"#\\+BBBBBBBB","errorType":"exception","errorClass":"CantNotFixContentException","httpStatus":null,"severity":"error","filePath":"dex-writer/src/main/java/com/googlecode/d2j/dex/writer/CodeWriter.java","lineNumber":267,"sourceCode":"    private byte[] build23x(Op op, int vAA, int vBB, int vCC) {\n        checkRegAA(op, \"vAA\", vAA);\n        checkRegAA(op, \"vBB\", vBB);\n        checkRegAA(op, \"vCC\", vCC);\n        b.position(0);\n        b.put((byte) op.opcode).put((byte) vAA).put((byte) vBB).put((byte) vCC);\n        return copy(b);\n    }\n\n    // AA|op BBBBlo BBBBhi\n    private byte[] build31i(Op op, int vAA, Number value) {\n        checkRegAA(op, \"vAA\", vAA);\n        int realV;\n        if (op == CONST) {\n            realV = value.intValue();\n        } else if (op == CONST_WIDE_32) {\n            long v = value.longValue();\n            if (v > Integer.MAX_VALUE || v < Integer.MIN_VALUE) {\n                throw new CantNotFixContentException(op, \"#+BBBBBBBB\", v);\n            }\n            realV = (int) v;\n        } else {\n            throw new RuntimeException();\n        }\n        b.position(0);\n        b.put((byte) op.opcode).put((byte) vAA).putInt(realV);\n        return copy(b);\n    }\n\n    // ØØ|op AAAA BBBB\n    private byte[] build32x(Op op, int vAAAA, int vBBBB) {\n        checkRegAAAA(op, \"vAAAA\", vAAAA);\n        checkRegAAAA(op, \"vBBBB\", vBBBB);\n        b.position(0);\n        b.put((byte) op.opcode).put((byte) 0).putShort((short) vAAAA).putShort((short) vBBBB);\n        return copy(b);\n    }","sourceCodeStart":249,"sourceCodeEnd":285,"githubUrl":"https://github.com/pxb1988/dex2jar/blob/b5bda4fb4935ae8b3869b422454ae3b3896c7bc1/dex-writer/src/main/java/com/googlecode/d2j/dex/writer/CodeWriter.java#L249-L285","documentation":"CodeWriter.build31i assembles the 31i format (const-wide/32), whose immediate is a signed 32-bit value. If the long value exceeds Integer.MAX_VALUE or is below Integer.MIN_VALUE, it cannot fit in the 32-bit slot, so CantNotFixContentException with message '#+BBBBBBBB' is thrown. CONST op values are not range-checked here since they are 32-bit by definition.","triggerScenarios":"visitConstStmt dispatching CONST_WIDE_32 with a long outside the int range, e.g. 0x1_0000_0000L.","commonSituations":"Constant-narrowing optimizations that classify longs as 32-bit encodable without an int-range check; translated Java code with large long literals.","solutions":["Range-check: only use CONST_WIDE_32 when v >= Integer.MIN_VALUE && v <= Integer.MAX_VALUE.","Otherwise emit the full 64-bit CONST_WIDE (51l format).","Fix the value-classification logic in visitConstStmt to test the int range before selecting 31i.","Catch CantNotFixContentException and re-emit with CONST_WIDE."],"exampleFix":"// before\nemitConst(CONST_WIDE_32, a, 8589934592L);\n// after\nif (v >= Integer.MIN_VALUE && v <= Integer.MAX_VALUE) emitConst(CONST_WIDE_32, a, v); else emitConst(CONST_WIDE, a, v);","handlingStrategy":"validation","validationCode":"boolean fitsInt(long v) { return v >= Integer.MIN_VALUE && v <= Integer.MAX_VALUE; }","typeGuard":null,"tryCatchPattern":"try {\n    emitConst(CONST_WIDE_32, a, v);\n} catch (CantNotFixContentException e) {\n    emitConst(CONST_WIDE, a, v); // full 64-bit const\n}","preventionTips":["Verify long values fit int range before selecting const-wide/32","Test narrowing at Integer.MIN_VALUE/MAX_VALUE boundaries","Fall back to CONST_WIDE for full 64-bit values","Keep opcode selection value-shape driven"],"tags":["dex","bytecode","constant-encoding","value-out-of-range"],"backgroundTag":"value-out-of-range","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"}