From 1a865e30ea2b152cb08e6757764850300c5a43bd Mon Sep 17 00:00:00 2001 From: Thomas White Date: Mon, 1 Nov 2010 22:25:54 +0000 Subject: [PATCH] HADOOP-6975. Integer overflow in S3InputStream for blocks > 2GB. Contributed by Patrick Kling. git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@1029867 13f79535-47bb-0310-9956-ffa450edef68 --- CHANGES.txt | 3 +++ src/java/org/apache/hadoop/fs/s3/S3InputStream.java | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/CHANGES.txt b/CHANGES.txt index e607a0c1062..7fb8cd8dace 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -292,6 +292,9 @@ Trunk (unreleased changes) HADOOP-7011. Fix KerberosName.main() to not throw an NPE. (Aaron T. Myers via tomwhite) + HADOOP-6975. Integer overflow in S3InputStream for blocks > 2GB. + (Patrick Kling via tomwhite) + Release 0.21.1 - Unreleased IMPROVEMENTS diff --git a/src/java/org/apache/hadoop/fs/s3/S3InputStream.java b/src/java/org/apache/hadoop/fs/s3/S3InputStream.java index 302174bf7e7..ec3f1502342 100644 --- a/src/java/org/apache/hadoop/fs/s3/S3InputStream.java +++ b/src/java/org/apache/hadoop/fs/s3/S3InputStream.java @@ -128,7 +128,7 @@ class S3InputStream extends FSInputStream { if (pos > blockEnd) { blockSeekTo(pos); } - int realLen = Math.min(len, (int) (blockEnd - pos + 1)); + int realLen = (int) Math.min((long) len, (blockEnd - pos + 1L)); int result = blockStream.read(buf, off, realLen); if (result >= 0) { pos += result;