{"record":{"id":"67175e85e990098c","repo":"prestodb/presto","slug":"value-out-of-bound-s","errorCode":null,"errorMessage":"Value out of bound: %s","messagePattern":"Value out of bound: (.+?)","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"presto-parquet/src/main/java/com/facebook/presto/parquet/spark/VariantUtil.java","lineNumber":174,"sourceCode":"        long signedByteValue = bytes[position + numBytes - 1];\n        result |= signedByteValue << (8 * (numBytes - 1));\n        return result;\n    }\n\n    // Read a little-endian unsigned int value from `bytes[position, position + numBytes)`. The value must fit\n    // into a non-negative int (`[0, Integer.MAX_VALUE]`).\n    static int readUnsigned(byte[] bytes, int position, int numBytes)\n    {\n        checkIndex(position, bytes.length);\n        checkIndex(position + numBytes - 1, bytes.length);\n        int result = 0;\n        // Similar to the `readLong` loop, but all bytes should be unsign-extended.\n        for (int i = 0; i < numBytes; ++i) {\n            int unsignedByteValue = bytes[position + i] & 0xFF;\n            result |= unsignedByteValue << (8 * i);\n        }\n        if (result < 0) {\n            throw new IllegalArgumentException(String.format(\"Value out of bound: %s\", result));\n        }\n        return result;\n    }\n\n    // The value type of variant value. It is determined by the header byte but not a 1:1 mapping\n    // (for example, INT1/2/4/8 all maps to `Type.LONG`).\n    public enum Type\n    {\n        NULL,\n        BOOLEAN,\n        LONG,\n        FLOAT,\n        DOUBLE,\n        DECIMAL,\n        STRING,\n        BINARY,\n        DATE,\n        TIMESTAMP,","sourceCodeStart":156,"sourceCodeEnd":192,"githubUrl":"https://github.com/prestodb/presto/blob/55bb57d202de3b926896fa966c2c4a44c779634e/presto-parquet/src/main/java/com/facebook/presto/parquet/spark/VariantUtil.java#L156-L192","documentation":"Guard in readUnsigned: a little-endian unsigned value read from the variant metadata/value bytes does not fit into a non-negative int (exceeds Integer.MAX_VALUE), or the assembled byte pattern is out of range for the field width. Marks the variant as malformed per the MALFORMED_VARIANT contract.","triggerScenarios":"Thrown at presto-parquet/src/main/java/com/facebook/presto/parquet/spark/VariantUtil.java:174 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Re-ingest the variant data from a trusted source","Add writer-side validation that u32 fields stay within int range","Align writer and reader on the variant encoding version"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"55bb57d202de3b926896fa966c2c4a44c779634e","analyzedAt":"2026-09-04T12:50:26.162Z","contentChangedAt":"2026-09-04T12:50:26.162Z","schemaVersion":2},"datasetVersion":"2026-09-11T21:17:09.523Z"}