{"record":{"id":"92e3de6e4c53b474","repo":"prestodb/presto","slug":"zstd-requires-buffer-s-larger-than-max-size-s","errorCode":null,"errorMessage":"Zstd requires buffer (%s) larger than max size (%s)","messagePattern":"Zstd requires buffer \\((.+?)\\) larger than max size \\((.+?)\\)","errorType":"exception","errorClass":"OrcCorruptionException","httpStatus":null,"severity":"error","filePath":"presto-orc/src/main/java/com/facebook/presto/orc/OrcZstdDecompressor.java","lineNumber":50,"sourceCode":"    {\n        this.orcDataSourceId = requireNonNull(orcDataSourceId, \"orcDataSourceId is null\");\n        this.maxBufferSize = maxBufferSize;\n        if (zstdJniDecompressionEnabled) {\n            this.decompressor = new ZstdJniDecompressor();\n        }\n        else {\n            this.decompressor = new ZstdDecompressor();\n        }\n    }\n\n    @Override\n    public int decompress(byte[] input, int offset, int length, OutputBuffer output)\n            throws OrcCorruptionException\n    {\n        try {\n            long uncompressedLength = ZstdDecompressor.getDecompressedSize(input, offset, length);\n            if (uncompressedLength > maxBufferSize) {\n                throw new OrcCorruptionException(orcDataSourceId, \"Zstd requires buffer (%s) larger than max size (%s)\", uncompressedLength, maxBufferSize);\n            }\n\n            byte[] buffer = output.initialize(toIntExact(uncompressedLength));\n            return decompressor.decompress(input, offset, length, buffer, 0, buffer.length);\n        }\n        catch (MalformedInputException e) {\n            throw new OrcCorruptionException(e, orcDataSourceId, \"Invalid compressed stream\");\n        }\n    }\n\n    @Override\n    public String toString()\n    {\n        return \"zstd\";\n    }\n}\n","sourceCodeStart":32,"sourceCodeEnd":67,"githubUrl":"https://github.com/prestodb/presto/blob/55bb57d202de3b926896fa966c2c4a44c779634e/presto-orc/src/main/java/com/facebook/presto/orc/OrcZstdDecompressor.java#L32-L67","documentation":"Zstd decompression guard in OrcZstdDecompressor: the frame header's declared decompressed size exceeds the configured max buffer size, so the read is refused before decompressing. The %s pair gives required vs allowed size; indicates either a corrupt zstd stream or a max-buffer-size config that is too small.","triggerScenarios":"Thrown at presto-orc/src/main/java/com/facebook/presto/orc/OrcZstdDecompressor.java:50 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Increase the ORC stream max buffer size configuration","Verify the zstd stream is not corrupted (declared size sanity)","Recompress the data with smaller stripe/stream sizes"],"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"}