Kouhei Sutou
null+****@clear*****
Tue Mar 21 19:04:37 JST 2017
Kouhei Sutou 2017-03-21 19:04:37 +0900 (Tue, 21 Mar 2017) New Revision: 5fd6cd8e058465a68f5c164aaae30570a903c388 https://github.com/groonga/groonga/commit/5fd6cd8e058465a68f5c164aaae30570a903c388 Message: expr_exec: add proc validation Window function can't be executed by grn_expr_exec(). Modified files: lib/expr.c Modified: lib/expr.c (+15 -3) =================================================================== --- lib/expr.c 2017-03-21 18:41:04 +0900 (9d8161d) +++ lib/expr.c 2017-03-21 19:04:37 +0900 (7551321) @@ -2584,9 +2584,21 @@ grn_expr_exec(grn_ctx *ctx, grn_obj *expr, int nargs) goto exit; } proc = sp[-offset]; - WITH_SPSAVE({ - grn_proc_call(ctx, proc, code->nargs, expr); - }); + if (grn_obj_is_window_function_proc(ctx, proc)) { + grn_obj inspected; + GRN_TEXT_INIT(&inspected, 0); + grn_inspect(ctx, &inspected, proc); + ERR(GRN_INVALID_ARGUMENT, + "window function can't be executed for each record: %.*s", + (int)GRN_TEXT_LEN(&inspected), + GRN_TEXT_VALUE(&inspected)); + GRN_OBJ_FIN(ctx, &inspected); + goto exit; + } else { + WITH_SPSAVE({ + grn_proc_call(ctx, proc, code->nargs, expr); + }); + } if (ctx->rc) { goto exit; } -------------- next part -------------- HTML����������������������������...Download