Merge "Prevent limit of search outbounding max int value" into stable-2.12

This commit is contained in:
David Pursehouse 2016-09-01 00:51:38 +00:00 committed by Gerrit Code Review
commit ccd5b75626

View File

@ -447,6 +447,9 @@ public class LuceneChangeIndex implements ChangeIndex {
IndexSearcher[] searchers = new IndexSearcher[indexes.size()];
try {
int realLimit = opts.start() + opts.limit();
if (Integer.MAX_VALUE - opts.limit() < opts.start()) {
realLimit = Integer.MAX_VALUE;
}
TopFieldDocs[] hits = new TopFieldDocs[indexes.size()];
for (int i = 0; i < indexes.size(); i++) {
searchers[i] = indexes.get(i).acquire();