lucene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jpou...@apache.org
Subject svn commit: r1440949 - in /lucene/dev/branches/branch_4x: ./ lucene/ lucene/core/ lucene/core/src/java/org/apache/lucene/util/packed/Packed64.java lucene/core/src/java/org/apache/lucene/util/packed/PackedInts.java
Date Thu, 31 Jan 2013 13:12:56 GMT
Author: jpountz
Date: Thu Jan 31 13:12:56 2013
New Revision: 1440949

URL: http://svn.apache.org/viewvc?rev=1440949&view=rev
Log:
LUCENE-4739: Fix integer overflow in Packed64.get/set (merged from r1440909).

Modified:
    lucene/dev/branches/branch_4x/   (props changed)
    lucene/dev/branches/branch_4x/lucene/   (props changed)
    lucene/dev/branches/branch_4x/lucene/core/   (props changed)
    lucene/dev/branches/branch_4x/lucene/core/src/java/org/apache/lucene/util/packed/Packed64.java
    lucene/dev/branches/branch_4x/lucene/core/src/java/org/apache/lucene/util/packed/PackedInts.java

Modified: lucene/dev/branches/branch_4x/lucene/core/src/java/org/apache/lucene/util/packed/Packed64.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/lucene/core/src/java/org/apache/lucene/util/packed/Packed64.java?rev=1440949&r1=1440948&r2=1440949&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/lucene/core/src/java/org/apache/lucene/util/packed/Packed64.java
(original)
+++ lucene/dev/branches/branch_4x/lucene/core/src/java/org/apache/lucene/util/packed/Packed64.java
Thu Jan 31 13:12:56 2013
@@ -153,7 +153,7 @@ class Packed64 extends PackedInts.Mutabl
 
     // bulk get
     assert index % decoder.longValueCount() == 0;
-    int blockIndex = (int) ((long) index * bitsPerValue) >>> BLOCK_BITS;
+    int blockIndex = (int) (((long) index * bitsPerValue) >>> BLOCK_BITS);
     assert (((long)index * bitsPerValue) & MOD_MASK) == 0;
     final int iterations = len / decoder.longValueCount();
     decoder.decode(blocks, blockIndex, arr, off, iterations);
@@ -217,7 +217,7 @@ class Packed64 extends PackedInts.Mutabl
 
     // bulk set
     assert index % encoder.longValueCount() == 0;
-    int blockIndex = (int) ((long) index * bitsPerValue) >>> BLOCK_BITS;
+    int blockIndex = (int) (((long) index * bitsPerValue) >>> BLOCK_BITS);
     assert (((long)index * bitsPerValue) & MOD_MASK) == 0;
     final int iterations = len / encoder.longValueCount();
     encoder.encode(arr, off, blocks, blockIndex, iterations);

Modified: lucene/dev/branches/branch_4x/lucene/core/src/java/org/apache/lucene/util/packed/PackedInts.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/lucene/core/src/java/org/apache/lucene/util/packed/PackedInts.java?rev=1440949&r1=1440948&r2=1440949&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/lucene/core/src/java/org/apache/lucene/util/packed/PackedInts.java
(original)
+++ lucene/dev/branches/branch_4x/lucene/core/src/java/org/apache/lucene/util/packed/PackedInts.java
Thu Jan 31 13:12:56 2013
@@ -1138,7 +1138,9 @@ public class PackedInts {
       }
       while (remaining > 0) {
         final int written = dest.set(destPos, buf, 0, remaining);
+        destPos += written;
         remaining -= written;
+        System.arraycopy(buf, written, buf, 0, remaining);
       }
     }
   }



Mime
View raw message