Skip to content

Commit

Permalink
lib-fts: Minor fix to randomness test in test-fts-tokenizer
Browse files Browse the repository at this point in the history
If the random input was entirely valid UTF-8, the input was truncated to
empty.
  • Loading branch information
sirainen authored and villesavolainen committed Apr 27, 2018
1 parent 9521a4e commit a3503eb
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/lib-fts/test-fts-tokenizer.c
Expand Up @@ -490,7 +490,8 @@ static void test_fts_tokenizer_random(void)
for (unsigned int j = 0; j < sizeof(addr); j++)
addr[j] = test_chars[i_rand() % N_ELEMENTS(test_chars)];
str_truncate(str, 0);
(void)uni_utf8_get_valid_data(addr, sizeof(addr), str);
if (uni_utf8_get_valid_data(addr, sizeof(addr), str))
str_append_data(str, addr, sizeof(addr));
while (fts_tokenizer_next(tok, str_data(str), str_len(str),
&token, &error) > 0) ;
while (fts_tokenizer_final(tok, &token, &error) > 0) ;
Expand Down

0 comments on commit a3503eb

Please sign in to comment.