mirror of https://github.com/apache/lucene.git
LUCENE-1457: fix possible overflow bugs during binary search
git-svn-id: https://svn.apache.org/repos/asf/lucene/java/trunk@723149 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
481f8080ab
commit
1fb2d4f280
|
@ -85,7 +85,7 @@ final class MergeDocIDRemapper {
|
|||
int hi = docMaps.length - 1; // for first element less
|
||||
|
||||
while (hi >= lo) {
|
||||
int mid = (lo + hi) >> 1;
|
||||
int mid = (lo + hi) >>> 1;
|
||||
int midValue = starts[mid];
|
||||
if (oldDocID < midValue)
|
||||
hi = mid - 1;
|
||||
|
|
|
@ -295,7 +295,7 @@ class MultiSegmentReader extends DirectoryIndexReader {
|
|||
int hi = numSubReaders - 1; // for first element less
|
||||
|
||||
while (hi >= lo) {
|
||||
int mid = (lo + hi) >> 1;
|
||||
int mid = (lo + hi) >>> 1;
|
||||
int midValue = starts[mid];
|
||||
if (n < midValue)
|
||||
hi = mid - 1;
|
||||
|
|
|
@ -195,7 +195,7 @@ final class TermInfosReader {
|
|||
int hi = indexTerms.length - 1;
|
||||
|
||||
while (hi >= lo) {
|
||||
int mid = (lo + hi) >> 1;
|
||||
int mid = (lo + hi) >>> 1;
|
||||
int delta = term.compareTo(indexTerms[mid]);
|
||||
if (delta < 0)
|
||||
hi = mid - 1;
|
||||
|
|
|
@ -48,7 +48,7 @@ public interface FieldCache {
|
|||
int high = lookup.length-1;
|
||||
|
||||
while (low <= high) {
|
||||
int mid = (low + high) >> 1;
|
||||
int mid = (low + high) >>> 1;
|
||||
int cmp = lookup[mid].compareTo(key);
|
||||
|
||||
if (cmp < 0)
|
||||
|
|
|
@ -168,7 +168,7 @@ public class MultiSearcher extends Searcher {
|
|||
int hi = searchables.length - 1; // for first element less
|
||||
// than n, return its index
|
||||
while (hi >= lo) {
|
||||
int mid = (lo + hi) >> 1;
|
||||
int mid = (lo + hi) >>> 1;
|
||||
int midValue = starts[mid];
|
||||
if (n < midValue)
|
||||
hi = mid - 1;
|
||||
|
|
Loading…
Reference in New Issue