Browse Source

HADOOP-5255. Fix use of Math.abs to avoid overflow. Contributed by Jonathan Ellis.

git-svn-id: https://svn.apache.org/repos/asf/hadoop/core/trunk@746166 13f79535-47bb-0310-9956-ffa450edef68
Christopher Douglas 16 năm trước cách đây
mục cha
commit
bb56687819
2 tập tin đã thay đổi với 4 bổ sung1 xóa
  1. 3 0
      CHANGES.txt
  2. 1 1
      src/core/org/apache/hadoop/util/bloom/HashFunction.java

+ 3 - 0
CHANGES.txt

@@ -798,6 +798,9 @@ Release 0.20.0 - Unreleased
     HADOOP-4692. Namenode in infinite loop for replicating/deleting corrupt
     blocks. (hairong)
 
+    HADOOP-5255. Fix use of Math.abs to avoid overflow. (Jonathan Ellis via
+    cdouglas)
+
 Release 0.19.1 - Unreleased
 
   IMPROVEMENTS

+ 1 - 1
src/core/org/apache/hadoop/util/bloom/HashFunction.java

@@ -112,7 +112,7 @@ public final class HashFunction {
       int[] result = new int[nbHash];
       for (int i = 0, initval = 0; i < nbHash; i++) {
 	  initval = hashFunction.hash(b, initval);
-	  result[i] = Math.abs(initval) % maxValue;
+	  result[i] = Math.abs(initval % maxValue);
       }
       return result;
   }