Skip to content

Commit

Permalink
HADOOP-19339. OutofBounds Exception due to assumption about buffer si…
Browse files Browse the repository at this point in the history
…ze in BlockCompressorStream. Contributed by ConfX.

Co-authored-by: saadsheralam <[email protected]>
Signed-off-by: He Xiaoqiao <[email protected]>
  • Loading branch information
teamconfx and saadsheralam authored Dec 8, 2024
1 parent de8b506 commit 58896f0
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,11 @@ public class BlockCompressorStream extends CompressorStream {
public BlockCompressorStream(OutputStream out, Compressor compressor,
int bufferSize, int compressionOverhead) {
super(out, compressor, bufferSize);
MAX_INPUT_SIZE = bufferSize - compressionOverhead;
if (bufferSize - compressionOverhead >= 0) {
MAX_INPUT_SIZE = bufferSize - compressionOverhead;
} else {
throw new IllegalArgumentException("buffer size is less than compression overhead");
}
}

/**
Expand Down

0 comments on commit 58896f0

Please sign in to comment.