You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-commits@hadoop.apache.org by he...@apache.org on 2024/12/08 10:44:12 UTC
(hadoop) branch trunk updated: HADOOP-19339. OutofBounds Exception due to assumption about buffer size in BlockCompressorStream. Contributed by ConfX.
This is an automated email from the ASF dual-hosted git repository.
hexiaoqiao pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/hadoop.git
The following commit(s) were added to refs/heads/trunk by this push:
new 58896f0e135 HADOOP-19339. OutofBounds Exception due to assumption about buffer size in BlockCompressorStream. Contributed by ConfX.
58896f0e135 is described below
commit 58896f0e13524c81853828d4d94b5f7298bafed5
Author: ConfX <11...@users.noreply.github.com>
AuthorDate: Sun Dec 8 04:44:04 2024 -0600
HADOOP-19339. OutofBounds Exception due to assumption about buffer size in BlockCompressorStream. Contributed by ConfX.
Co-authored-by: saadsheralam <sa...@gmail.com>
Signed-off-by: He Xiaoqiao <he...@apache.org>
---
.../java/org/apache/hadoop/io/compress/BlockCompressorStream.java | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/io/compress/BlockCompressorStream.java b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/io/compress/BlockCompressorStream.java
index 434183bbc25..3e6826afc85 100644
--- a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/io/compress/BlockCompressorStream.java
+++ b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/io/compress/BlockCompressorStream.java
@@ -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");
+ }
}
/**
---------------------------------------------------------------------
To unsubscribe, e-mail: common-commits-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-commits-help@hadoop.apache.org