Kouhei Sutou
null+****@clear*****
Mon May 28 14:16:05 JST 2018
Kouhei Sutou 2018-05-28 14:16:05 +0900 (Mon, 28 May 2018) New Revision: 82488945dd6b0c0dc5f8eade5102ecc419cba6a8 https://github.com/groonga/groonga/commit/82488945dd6b0c0dc5f8eade5102ecc419cba6a8 Message: Fix allocated size Modified files: lib/tokenizers.c Modified: lib/tokenizers.c (+2 -2) =================================================================== --- lib/tokenizers.c 2018-05-28 14:15:24 +0900 (6b3667d21) +++ lib/tokenizers.c 2018-05-28 14:16:05 +0900 (317f2ef16) @@ -345,7 +345,7 @@ ngram_switch_to_loose_mode(grn_ctx *ctx, unsigned int n_chars = 0; tokenizer->loose.ctypes = - GRN_MALLOC(sizeof(uint_least8_t) * normalized_length_in_chars); + GRN_MALLOC(sizeof(uint_least8_t) * (normalized_length_in_chars + 1)); if (!tokenizer->loose.ctypes) { ERR(GRN_NO_MEMORY_AVAILABLE, "[tokenizer][ngram][loose] " @@ -365,7 +365,7 @@ ngram_switch_to_loose_mode(grn_ctx *ctx, } if (offsets) { tokenizer->loose.offsets = - GRN_CALLOC(sizeof(uint64_t) * normalized_length_in_chars); + GRN_CALLOC(sizeof(uint64_t) * (normalized_length_in_chars + 1)); if (!tokenizer->loose.offsets) { ERR(GRN_NO_MEMORY_AVAILABLE, "[tokenizer][ngram][loose] " -------------- next part -------------- HTML����������������������������... URL: https://lists.osdn.me/mailman/archives/groonga-commit/attachments/20180528/42c8804f/attachment-0001.htm