You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by nk...@apache.org on 2016/02/08 23:36:01 UTC
[26/50] [abbrv] lucene-solr git commit: LUCENE-6910: fix 'if ... >
Integer.MAX_VALUE' check in (Binary|Numeric)DocValuesFieldUpdates.merge
(https://scan.coverity.com/projects/5620 CID 119973 and CID 120081)
LUCENE-6910: fix 'if ... > Integer.MAX_VALUE' check in (Binary|Numeric)DocValuesFieldUpdates.merge (https://scan.coverity.com/projects/5620 CID 119973 and CID 120081)
git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/branches/lucene_solr_5_4@1724055 13f79535-47bb-0310-9956-ffa450edef68
Project: http://git-wip-us.apache.org/repos/asf/lucene-solr/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucene-solr/commit/dd0eefe5
Tree: http://git-wip-us.apache.org/repos/asf/lucene-solr/tree/dd0eefe5
Diff: http://git-wip-us.apache.org/repos/asf/lucene-solr/diff/dd0eefe5
Branch: refs/heads/branch_5_4
Commit: dd0eefe54ddf37df81be3bae7446e1dfa5d60891
Parents: a9bfb90
Author: Adrien Grand <jp...@apache.org>
Authored: Mon Jan 11 15:05:24 2016 +0000
Committer: Adrien Grand <jp...@apache.org>
Committed: Mon Jan 11 15:05:24 2016 +0000
----------------------------------------------------------------------
lucene/CHANGES.txt | 5 +++++
.../org/apache/lucene/index/BinaryDocValuesFieldUpdates.java | 4 ++--
.../org/apache/lucene/index/NumericDocValuesFieldUpdates.java | 2 +-
3 files changed, 8 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/dd0eefe5/lucene/CHANGES.txt
----------------------------------------------------------------------
diff --git a/lucene/CHANGES.txt b/lucene/CHANGES.txt
index 2ee15c9..2d1e11e 100644
--- a/lucene/CHANGES.txt
+++ b/lucene/CHANGES.txt
@@ -20,6 +20,11 @@ Bug Fixes
* LUCENE-6929: Fix SpanNotQuery rewriting to not drop the pre/post parameters.
(Tim Allison via Adrien Grand)
+* LUCENE-6910: fix 'if ... > Integer.MAX_VALUE' check in
+ (Binary|Numeric)DocValuesFieldUpdates.merge
+ (https://scan.coverity.com/projects/5620 CID 119973 and CID 120081)
+ (Christine Poerschke, Coverity Scan (via Rishabh Patel))
+
======================= Lucene 5.4.0 =======================
New Features
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/dd0eefe5/lucene/core/src/java/org/apache/lucene/index/BinaryDocValuesFieldUpdates.java
----------------------------------------------------------------------
diff --git a/lucene/core/src/java/org/apache/lucene/index/BinaryDocValuesFieldUpdates.java b/lucene/core/src/java/org/apache/lucene/index/BinaryDocValuesFieldUpdates.java
index a5b817f..684afef 100644
--- a/lucene/core/src/java/org/apache/lucene/index/BinaryDocValuesFieldUpdates.java
+++ b/lucene/core/src/java/org/apache/lucene/index/BinaryDocValuesFieldUpdates.java
@@ -169,12 +169,12 @@ class BinaryDocValuesFieldUpdates extends DocValuesFieldUpdates {
@Override
public void merge(DocValuesFieldUpdates other) {
BinaryDocValuesFieldUpdates otherUpdates = (BinaryDocValuesFieldUpdates) other;
- int newSize = size + otherUpdates.size;
- if (newSize > Integer.MAX_VALUE) {
+ if (otherUpdates.size > Integer.MAX_VALUE - size) {
throw new IllegalStateException(
"cannot support more than Integer.MAX_VALUE doc/value entries; size="
+ size + " other.size=" + otherUpdates.size);
}
+ final int newSize = size + otherUpdates.size;
docs = docs.grow(newSize);
offsets = offsets.grow(newSize);
lengths = lengths.grow(newSize);
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/dd0eefe5/lucene/core/src/java/org/apache/lucene/index/NumericDocValuesFieldUpdates.java
----------------------------------------------------------------------
diff --git a/lucene/core/src/java/org/apache/lucene/index/NumericDocValuesFieldUpdates.java b/lucene/core/src/java/org/apache/lucene/index/NumericDocValuesFieldUpdates.java
index dd6e859..641c594 100644
--- a/lucene/core/src/java/org/apache/lucene/index/NumericDocValuesFieldUpdates.java
+++ b/lucene/core/src/java/org/apache/lucene/index/NumericDocValuesFieldUpdates.java
@@ -144,7 +144,7 @@ class NumericDocValuesFieldUpdates extends DocValuesFieldUpdates {
public void merge(DocValuesFieldUpdates other) {
assert other instanceof NumericDocValuesFieldUpdates;
NumericDocValuesFieldUpdates otherUpdates = (NumericDocValuesFieldUpdates) other;
- if (size + otherUpdates.size > Integer.MAX_VALUE) {
+ if (otherUpdates.size > Integer.MAX_VALUE - size) {
throw new IllegalStateException(
"cannot support more than Integer.MAX_VALUE doc/value entries; size="
+ size + " other.size=" + otherUpdates.size);