[Groonga-commit] groonga/groonga at 1334897 [master] TokenMecab: add missing error check

Back to archive index

Kouhei Sutou null+****@clear*****
Tue Sep 11 11:09:57 JST 2018


Kouhei Sutou	2018-09-11 11:09:57 +0900 (Tue, 11 Sep 2018)

  Revision: 13348977f54fb5f641b244bf5201b91568cd24be
  https://github.com/groonga/groonga/commit/13348977f54fb5f641b244bf5201b91568cd24be

  Message:
    TokenMecab: add missing error check

  Modified files:
    plugins/tokenizers/mecab.c

  Modified: plugins/tokenizers/mecab.c (+4 -1)
===================================================================
--- plugins/tokenizers/mecab.c    2018-09-11 11:06:49 +0900 (ba67d6ece)
+++ plugins/tokenizers/mecab.c    2018-09-11 11:09:57 +0900 (d9a6f2aef)
@@ -797,7 +797,10 @@ mecab_next_default_format(grn_ctx *ctx,
   grn_token_set_data(ctx, token, surface, surface_length);
   {
     grn_tokenizer_status status;
-    if (tokenizer->next == tokenizer->end) {
+    if (surface_length == 0) {
+      /* Error */
+      status = GRN_TOKEN_LAST;
+    } else if (tokenizer->next == tokenizer->end) {
       if (tokenizer->loose.need) {
         tokenizer->loose.ing = GRN_TRUE;
         status = GRN_TOKEN_CONTINUE;
-------------- next part --------------
HTML����������������������������...
URL: https://lists.osdn.me/mailman/archives/groonga-commit/attachments/20180911/911b3e23/attachment.htm 



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