You are viewing a plain text version of this content. The canonical link for it is here.
Posted to oak-commits@jackrabbit.apache.org by re...@apache.org on 2024/04/23 14:31:34 UTC
(jackrabbit-oak) 01/01: OAK-10777: oak-lucene: add test coverage for stack overflow based on very long and complex regexp using JCR lucene native query
This is an automated email from the ASF dual-hosted git repository.
reschke pushed a commit to branch OAK-10777
in repository https://gitbox.apache.org/repos/asf/jackrabbit-oak.git
commit 9f6dc23c0be7708e568d34a79654063da8e264e1
Author: Julian Reschke <re...@apache.org>
AuthorDate: Tue Apr 23 15:31:18 2024 +0100
OAK-10777: oak-lucene: add test coverage for stack overflow based on very long and complex regexp using JCR lucene native query
---
.../oak/plugins/index/FullTextIndexCommonTest.java | 22 ++++++++++++++++++++++
1 file changed, 22 insertions(+)
diff --git a/oak-search/src/test/java/org/apache/jackrabbit/oak/plugins/index/FullTextIndexCommonTest.java b/oak-search/src/test/java/org/apache/jackrabbit/oak/plugins/index/FullTextIndexCommonTest.java
index e32c77fcdd..e02d1ead07 100644
--- a/oak-search/src/test/java/org/apache/jackrabbit/oak/plugins/index/FullTextIndexCommonTest.java
+++ b/oak-search/src/test/java/org/apache/jackrabbit/oak/plugins/index/FullTextIndexCommonTest.java
@@ -22,6 +22,7 @@ import org.apache.jackrabbit.oak.api.Type;
import org.apache.jackrabbit.oak.plugins.index.search.FulltextIndexConstants;
import org.apache.jackrabbit.oak.plugins.index.search.util.IndexDefinitionBuilder;
import org.apache.jackrabbit.oak.query.AbstractQueryTest;
+import org.junit.Ignore;
import org.junit.Test;
import java.util.List;
@@ -63,6 +64,27 @@ public abstract class FullTextIndexCommonTest extends AbstractQueryTest {
});
}
+ @Test
+ @Ignore("OAK-10777")
+ public void fullTextQueryRegExp() throws Exception {
+ Tree index = setup(builder -> builder.indexRule("nt:base").property("propa").analyzed(), idx -> {
+ },
+ "propa");
+
+ // test borrowed from: https://github.com/apache/lucene/issues/11537
+ StringBuilder strBuilder = new StringBuilder();
+ for (int i = 0; i < 50000; i++) {
+ strBuilder.append("b");
+ }
+
+ String query = "//*[rep:native('lucene', '/" + strBuilder + "/')]";
+
+ assertEventually(() -> {
+ assertThat(explain(query, XPATH), containsString(indexOptions.getIndexType() + ":" + index.getName()));
+ assertQuery(query, XPATH, List.of());
+ });
+ }
+
@Test
public void fullTextQueryWithDifferentBoosts() throws Exception {
setup(builder -> {