hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aajis...@apache.org
Subject hadoop git commit: HADOOP-13202. Avoid possible overflow in org.apache.hadoop.util.bloom.BloomFilter#getNBytes. Contributed by Kai Sasaki.
Date Mon, 18 Jul 2016 18:52:57 GMT
Repository: hadoop
Updated Branches:
  refs/heads/branch-2.7 65adabd0d -> 833117c21


HADOOP-13202. Avoid possible overflow in org.apache.hadoop.util.bloom.BloomFilter#getNBytes.
Contributed by Kai Sasaki.

(cherry picked from commit c2bcffb34ebe4399b523a44f69d23761648bd0c4)
(cherry picked from commit 09375baad1ba732b73701cdbd0ee77618ed6f687)


Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo
Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/833117c2
Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/833117c2
Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/833117c2

Branch: refs/heads/branch-2.7
Commit: 833117c2199bddcd1e05b5abf138989dd9e43172
Parents: 65adabd
Author: Akira Ajisaka <aajisaka@apache.org>
Authored: Mon Jul 18 11:42:56 2016 -0700
Committer: Akira Ajisaka <aajisaka@apache.org>
Committed: Mon Jul 18 11:52:43 2016 -0700

----------------------------------------------------------------------
 hadoop-common-project/hadoop-common/CHANGES.txt         |  4 ++++
 .../java/org/apache/hadoop/util/bloom/BloomFilter.java  |  2 +-
 .../org/apache/hadoop/util/bloom/TestBloomFilters.java  | 12 ++++++++++++
 3 files changed, 17 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hadoop/blob/833117c2/hadoop-common-project/hadoop-common/CHANGES.txt
----------------------------------------------------------------------
diff --git a/hadoop-common-project/hadoop-common/CHANGES.txt b/hadoop-common-project/hadoop-common/CHANGES.txt
index cae1f1e..8b67bd6 100644
--- a/hadoop-common-project/hadoop-common/CHANGES.txt
+++ b/hadoop-common-project/hadoop-common/CHANGES.txt
@@ -18,6 +18,10 @@ Release 2.7.4 - UNRELEASED
     HADOOP-11361. Fix a race condition in MetricsSourceAdapter.updateJmxCache.
     (Vinayakumar B, Yongjun Zhang, and Brahma Reddy Battula via ozawa)
 
+    HADOOP-13202. Avoid possible overflow in
+    org.apache.hadoop.util.bloom.BloomFilter#getNBytes.
+    (Kai Sasaki via aajisaka)
+
 Release 2.7.3 - UNRELEASED
 
   INCOMPATIBLE CHANGES

http://git-wip-us.apache.org/repos/asf/hadoop/blob/833117c2/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/util/bloom/BloomFilter.java
----------------------------------------------------------------------
diff --git a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/util/bloom/BloomFilter.java
b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/util/bloom/BloomFilter.java
index f8b9519..82d18b8 100644
--- a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/util/bloom/BloomFilter.java
+++ b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/util/bloom/BloomFilter.java
@@ -234,6 +234,6 @@ public class BloomFilter extends Filter {
   
   /* @return number of bytes needed to hold bit vector */
   private int getNBytes() {
-    return (vectorSize + 7) / 8;
+    return (int)(((long)vectorSize + 7) / 8);
   }
 }//end class

http://git-wip-us.apache.org/repos/asf/hadoop/blob/833117c2/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/util/bloom/TestBloomFilters.java
----------------------------------------------------------------------
diff --git a/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/util/bloom/TestBloomFilters.java
b/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/util/bloom/TestBloomFilters.java
index 6ff854d..8552565 100644
--- a/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/util/bloom/TestBloomFilters.java
+++ b/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/util/bloom/TestBloomFilters.java
@@ -240,6 +240,18 @@ public class TestBloomFilters {
   }
 
   @Test
+  public void testFiltersWithLargeVectorSize() {
+    int hashId = Hash.MURMUR_HASH;
+    Filter filter
+        = new BloomFilter(Integer.MAX_VALUE, hashFunctionNumber, hashId);
+    BloomFilterCommonTester.of(hashId, numInsertions)
+        .withFilterInstance(filter)
+        .withTestCases(ImmutableSet.of(
+                BloomFilterTestStrategy.WRITE_READ_STRATEGY
+        )).test();
+  }
+
+  @Test
   public void testNot() {
     BloomFilter bf = new BloomFilter(8, 1, Hash.JENKINS_HASH);
     bf.bits = BitSet.valueOf(new byte[] { (byte) 0x95 });


---------------------------------------------------------------------
To unsubscribe, e-mail: common-commits-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-commits-help@hadoop.apache.org


Mime
View raw message