[Groonga-commit] groonga/groonga at 2a65222 [master] select match_columns: report error for invalid match_columns

Back to archive index

Kouhei Sutou null+****@clear*****
Sat Jan 3 14:38:17 JST 2015


Kouhei Sutou	2015-01-03 14:38:17 +0900 (Sat, 03 Jan 2015)

  New Revision: 2a6522208f1b5feb82169a5861c63e2e1cc0c436
  https://github.com/groonga/groonga/commit/2a6522208f1b5feb82169a5861c63e2e1cc0c436

  Message:
    select match_columns: report error for invalid match_columns
    
    GitHub: #269
    
    Reported by Naoya Murakami. Thanks!!!

  Modified files:
    lib/expr.c

  Modified: lib/expr.c (+18 -0)
===================================================================
--- lib/expr.c    2015-01-03 14:33:24 +0900 (649c6d6)
+++ lib/expr.c    2015-01-03 14:38:17 +0900 (e57c946)
@@ -4663,6 +4663,18 @@ scan_info_build_match(grn_ctx *ctx, scan_info *si)
               ec += offset;
             }
             break;
+          default :
+            {
+              char name[GRN_TABLE_MAX_KEY_SIZE];
+              int name_size;
+              name_size = grn_obj_name(ctx, ec->value,
+                                       name, GRN_TABLE_MAX_KEY_SIZE);
+              ERR(GRN_INVALID_ARGUMENT,
+                  "invalid match target: <%.*s>",
+                  name_size, name);
+              return;
+            }
+            break;
           }
         }
       }
@@ -4827,6 +4839,12 @@ scan_info_build(grn_ctx *ctx, grn_obj *expr, int *n,
       si->end = c - e->codes;
       sis[i++] = si;
       scan_info_build_match(ctx, si);
+      if (ctx->rc != GRN_SUCCESS) {
+        int j;
+        for (j = 0; j < i; j++) { SI_FREE(sis[j]); }
+        GRN_FREE(sis);
+        return NULL;
+      }
       si = NULL;
       break;
     case GRN_OP_AND :
-------------- next part --------------
HTML����������������������������...
Descargar 



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