susumu.yata
null+****@clear*****
Tue Sep 29 01:01:37 JST 2015
susumu.yata 2015-09-29 01:01:37 +0900 (Tue, 29 Sep 2015) New Revision: eea516d2948e87d2be571c5fdc4738286bf80172 https://github.com/groonga/groonga/commit/eea516d2948e87d2be571c5fdc4738286bf80172 Message: grn_ts: check results of strtol() and strtod() GitHub: #404 Modified files: lib/ts.c Modified: lib/ts.c (+4 -1) =================================================================== --- lib/ts.c 2015-09-29 00:49:26 +0900 (24cf55a) +++ lib/ts.c 2015-09-29 01:01:37 +0900 (6341b4a) @@ -4786,7 +4786,7 @@ grn_ts_expr_parser_tokenize_number(grn_ctx *ctx, grn_ts_expr_parser *parser, buf[str.size] = '\0'; int_value = strtol(buf, &end, 0); - if (*end != '.') { + if ((end != buf) && (*end != '.')) { token_str.ptr = str.ptr; token_str.size = end - buf; rc = grn_ts_expr_const_token_open(ctx, token_str, &new_token); @@ -4796,6 +4796,9 @@ grn_ts_expr_parser_tokenize_number(grn_ctx *ctx, grn_ts_expr_parser *parser, } } else { grn_ts_float float_value = strtod(buf, &end); + if (end == buf) { + return GRN_INVALID_FORMAT; + } token_str.ptr = str.ptr; token_str.size = end - buf; rc = grn_ts_expr_const_token_open(ctx, token_str, &new_token); -------------- next part -------------- HTML����������������������������... ダウンロード