lucene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jpou...@apache.org
Subject svn commit: r1440909 - in /lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/util/packed: Packed64.java PackedInts.java
Date Thu, 31 Jan 2013 11:15:18 GMT
Author: jpountz
Date: Thu Jan 31 11:15:17 2013
New Revision: 1440909

URL: http://svn.apache.org/viewvc?rev=1440909&view=rev
Log:
LUCENE-4739: Fix integer overflow in Packed64.get/set.

Modified:
    lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/util/packed/Packed64.java
    lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/util/packed/PackedInts.java

Modified: lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/util/packed/Packed64.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/util/packed/Packed64.java?rev=1440909&r1=1440908&r2=1440909&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/util/packed/Packed64.java (original)
+++ lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/util/packed/Packed64.java Thu
Jan 31 11:15:17 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/trunk/lucene/core/src/java/org/apache/lucene/util/packed/PackedInts.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/util/packed/PackedInts.java?rev=1440909&r1=1440908&r2=1440909&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/util/packed/PackedInts.java (original)
+++ lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/util/packed/PackedInts.java Thu
Jan 31 11:15:17 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