lucene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sim...@apache.org
Subject [1/2] lucene-solr:master: LUCENE-8164: IndexWriter silently accepts broken payload.
Date Wed, 13 Jun 2018 08:19:02 GMT
Repository: lucene-solr
Updated Branches:
  refs/heads/branch_7x 968331289 -> 9ea1fa535
  refs/heads/master 61e68ec1e -> 7eb74ac50


LUCENE-8164: IndexWriter silently accepts broken payload.

This has been fixed via LUCENE-8165 since we are now checking
for offset+length going out of bounds.

Co-authored-by: Nhat Nguyen <nhat.nguyen@elastic.co>
Co-authored-by: Robert Muir <rmuir@apache.org>


Project: http://git-wip-us.apache.org/repos/asf/lucene-solr/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucene-solr/commit/7eb74ac5
Tree: http://git-wip-us.apache.org/repos/asf/lucene-solr/tree/7eb74ac5
Diff: http://git-wip-us.apache.org/repos/asf/lucene-solr/diff/7eb74ac5

Branch: refs/heads/master
Commit: 7eb74ac50f5e6e05389e834a1a2bf2543dfd64c9
Parents: 61e68ec
Author: Simon Willnauer <simonw@apache.org>
Authored: Wed Jun 13 10:16:33 2018 +0200
Committer: Simon Willnauer <simonw@apache.org>
Committed: Wed Jun 13 10:16:33 2018 +0200

----------------------------------------------------------------------
 lucene/CHANGES.txt                                   |  6 +++++-
 .../org/apache/lucene/index/TestIndexWriter.java     | 15 +++++++++++++++
 2 files changed, 20 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/7eb74ac5/lucene/CHANGES.txt
----------------------------------------------------------------------
diff --git a/lucene/CHANGES.txt b/lucene/CHANGES.txt
index 0f7c486..83177a8 100644
--- a/lucene/CHANGES.txt
+++ b/lucene/CHANGES.txt
@@ -109,7 +109,11 @@ Optimizations
 
 ======================= Lucene 7.5.0 =======================
 
-(No changes)
+Bug Fixes:
+
+ * LUCENE-8164: IndexWriter silently accepts broken payload. This has been fixed
+   via LUCENE-8165 since we are now checking for offset+length going out of bounds.
+   (Robert Muir, Nhat Nyugen, Simon Willnauer)
 
 ======================= Lucene 7.4.0 =======================
 

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/7eb74ac5/lucene/core/src/test/org/apache/lucene/index/TestIndexWriter.java
----------------------------------------------------------------------
diff --git a/lucene/core/src/test/org/apache/lucene/index/TestIndexWriter.java b/lucene/core/src/test/org/apache/lucene/index/TestIndexWriter.java
index 967055e..72bd529 100644
--- a/lucene/core/src/test/org/apache/lucene/index/TestIndexWriter.java
+++ b/lucene/core/src/test/org/apache/lucene/index/TestIndexWriter.java
@@ -49,6 +49,7 @@ import org.apache.lucene.analysis.CannedTokenStream;
 import org.apache.lucene.analysis.MockAnalyzer;
 import org.apache.lucene.analysis.MockTokenFilter;
 import org.apache.lucene.analysis.MockTokenizer;
+import org.apache.lucene.analysis.Token;
 import org.apache.lucene.analysis.TokenStream;
 import org.apache.lucene.analysis.Tokenizer;
 import org.apache.lucene.analysis.tokenattributes.CharTermAttribute;
@@ -3500,4 +3501,18 @@ public class TestIndexWriter extends LuceneTestCase {
     w.close();
     dir.close();
   }
+
+  public void testBrokenPayload() throws Exception {
+    Directory d = newDirectory();
+    IndexWriter w = new IndexWriter(d, newIndexWriterConfig(new MockAnalyzer(random())));
+    Document doc = new Document();
+    Token token = new Token("bar", 0, 3);
+    BytesRef evil = new BytesRef(new byte[1024]);
+    evil.offset = 1000; // offset + length is now out of bounds.
+    token.setPayload(evil);
+    doc.add(new TextField("foo", new CannedTokenStream(token)));
+    expectThrows(IndexOutOfBoundsException.class, () -> w.addDocument(doc));
+    w.close();
+    d.close();
+  }
 }


Mime
View raw message