[Groonga-commit] groonga/groonga at 1094e39 [master] snippet_html: fix a crash bug when --query is empty

Back to archive index

Kouhei Sutou null+****@clear*****
Tue Feb 4 13:12:33 JST 2014


Kouhei Sutou	2014-02-04 13:12:33 +0900 (Tue, 04 Feb 2014)

  New Revision: 1094e392321e20022542b12bdb1e1a61f2a6a586
  https://github.com/groonga/groonga/commit/1094e392321e20022542b12bdb1e1a61f2a6a586

  Message:
    snippet_html: fix a crash bug when --query is empty
    
    [groonga-dev,02097]
    
    Reported by Naoya Murakami. Thanks!!!

  Added files:
    test/command/suite/select/function/snippet_html/empty_query.expected
    test/command/suite/select/function/snippet_html/empty_query.test
  Modified files:
    lib/proc.c

  Modified: lib/proc.c (+4 -0)
===================================================================
--- lib/proc.c    2014-02-03 15:30:00 +0900 (24a4674)
+++ lib/proc.c    2014-02-04 13:12:33 +0900 (a3e3a43)
@@ -3729,6 +3729,10 @@ func_snippet_html(grn_ctx *ctx, int nargs, grn_obj **args,
     }
   }
 
+  if (!snippets) {
+    snippets = GRN_PROC_ALLOC(GRN_DB_VOID, 0);
+  }
+
   return snippets;
 }
 

  Added: test/command/suite/select/function/snippet_html/empty_query.expected (+16 -0) 100644
===================================================================
--- /dev/null
+++ test/command/suite/select/function/snippet_html/empty_query.expected    2014-02-04 13:12:33 +0900 (e314547)
@@ -0,0 +1,16 @@
+table_create Documents TABLE_HASH_KEY ShortText
+[[0,0.0,0.0],true]
+column_create Documents content COLUMN_SCALAR Text
+[[0,0.0,0.0],true]
+table_create Terms TABLE_PAT_KEY|KEY_NORMALIZE ShortText --default_tokenizer TokenBigram
+[[0,0.0,0.0],true]
+column_create Terms document_index COLUMN_INDEX|WITH_POSITION Documents content
+[[0,0.0,0.0],true]
+load --table Documents
+[
+["_key", "content"],
+["About Groonga", "Groonga is an open-source fulltext search engine and column store. It lets you write high-performance applications that requires fulltext search."]
+]
+[[0,0.0,0.0],1]
+select Documents   --match_columns content --query ''   --output_columns 'snippet_html(content)'   --command_version 2
+[[0,0.0,0.0],[[[1],[["snippet_html","null"]],[null]]]]

  Added: test/command/suite/select/function/snippet_html/empty_query.test (+16 -0) 100644
===================================================================
--- /dev/null
+++ test/command/suite/select/function/snippet_html/empty_query.test    2014-02-04 13:12:33 +0900 (22c3a22)
@@ -0,0 +1,16 @@
+table_create Documents TABLE_HASH_KEY ShortText
+column_create Documents content COLUMN_SCALAR Text
+
+table_create Terms TABLE_PAT_KEY|KEY_NORMALIZE ShortText --default_tokenizer TokenBigram
+column_create Terms document_index COLUMN_INDEX|WITH_POSITION Documents content
+
+load --table Documents
+[
+["_key", "content"],
+["About Groonga", "Groonga is an open-source fulltext search engine and column store. It lets you write high-performance applications that requires fulltext search."]
+]
+
+select Documents \
+  --match_columns content --query '' \
+  --output_columns 'snippet_html(content)' \
+  --command_version 2
-------------- next part --------------
HTML����������������������������...
Download 



More information about the Groonga-commit mailing list
Back to archive index