lucene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sha...@apache.org
Subject svn commit: r1483258 - in /lucene/dev/branches/lucene_solr_4_3: ./ lucene/ lucene/CHANGES.txt lucene/highlighter/ lucene/highlighter/src/java/org/apache/lucene/search/postingshighlight/Passage.java
Date Thu, 16 May 2013 09:01:10 GMT
Author: shalin
Date: Thu May 16 09:01:10 2013
New Revision: 1483258

URL: http://svn.apache.org/r1483258
Log:
LUCENE-4948: Fix stinkbug in PostingsHighlighter (wrong array sizing on some jvms)

Modified:
    lucene/dev/branches/lucene_solr_4_3/   (props changed)
    lucene/dev/branches/lucene_solr_4_3/lucene/   (props changed)
    lucene/dev/branches/lucene_solr_4_3/lucene/CHANGES.txt   (contents, props changed)
    lucene/dev/branches/lucene_solr_4_3/lucene/highlighter/   (props changed)
    lucene/dev/branches/lucene_solr_4_3/lucene/highlighter/src/java/org/apache/lucene/search/postingshighlight/Passage.java

Modified: lucene/dev/branches/lucene_solr_4_3/lucene/CHANGES.txt
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene_solr_4_3/lucene/CHANGES.txt?rev=1483258&r1=1483257&r2=1483258&view=diff
==============================================================================
--- lucene/dev/branches/lucene_solr_4_3/lucene/CHANGES.txt (original)
+++ lucene/dev/branches/lucene_solr_4_3/lucene/CHANGES.txt Thu May 16 09:01:10 2013
@@ -14,6 +14,10 @@ Bug Fixes
 * LUCENE-4935: CustomScoreQuery wrongly applied its query boost twice
   (boost^2).  (Robert Muir)
 
+* LUCENE-4948: Fixed ArrayIndexOutOfBoundsException in PostingsHighlighter
+  if you had a 64-bit JVM without compressed OOPS: IBM J9, or Oracle with
+  large heap/explicitly disabled.  (Mike McCandless, Uwe Schindler, Robert Muir)
+
 ======================= Lucene 4.3.0 =======================
 
 Changes in backwards compatibility policy

Modified: lucene/dev/branches/lucene_solr_4_3/lucene/highlighter/src/java/org/apache/lucene/search/postingshighlight/Passage.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene_solr_4_3/lucene/highlighter/src/java/org/apache/lucene/search/postingshighlight/Passage.java?rev=1483258&r1=1483257&r2=1483258&view=diff
==============================================================================
--- lucene/dev/branches/lucene_solr_4_3/lucene/highlighter/src/java/org/apache/lucene/search/postingshighlight/Passage.java
(original)
+++ lucene/dev/branches/lucene_solr_4_3/lucene/highlighter/src/java/org/apache/lucene/search/postingshighlight/Passage.java
Thu May 16 09:01:10 2013
@@ -42,12 +42,18 @@ public final class Passage {
   void addMatch(int startOffset, int endOffset, BytesRef term) {
     assert startOffset >= this.startOffset && startOffset <= this.endOffset;
     if (numMatches == matchStarts.length) {
-      matchStarts = ArrayUtil.grow(matchStarts, numMatches+1);
-      matchEnds = ArrayUtil.grow(matchEnds, numMatches+1);
-      BytesRef newMatchTerms[] = new BytesRef[ArrayUtil.oversize(numMatches+1, RamUsageEstimator.NUM_BYTES_OBJECT_REF)];
+      int newLength = ArrayUtil.oversize(numMatches+1, RamUsageEstimator.NUM_BYTES_OBJECT_REF);
+      int newMatchStarts[] = new int[newLength];
+      int newMatchEnds[] = new int[newLength];
+      BytesRef newMatchTerms[] = new BytesRef[newLength];
+      System.arraycopy(matchStarts, 0, newMatchStarts, 0, numMatches);
+      System.arraycopy(matchEnds, 0, newMatchEnds, 0, numMatches);
       System.arraycopy(matchTerms, 0, newMatchTerms, 0, numMatches);
+      matchStarts = newMatchStarts;
+      matchEnds = newMatchEnds;
       matchTerms = newMatchTerms;
     }
+    assert matchStarts.length == matchEnds.length && matchEnds.length == matchTerms.length;
     matchStarts[numMatches] = startOffset;
     matchEnds[numMatches] = endOffset;
     matchTerms[numMatches] = term;



Mime
View raw message