summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArun Kuruvila <arun.kuruvila@oracle.com>2016-02-23 11:41:03 +0530
committerArun Kuruvila <arun.kuruvila@oracle.com>2016-02-23 11:41:03 +0530
commit83d20ca3fbab4ffa160fd3554e9e36a868fb2ab1 (patch)
treec3b6e8a760596a53689b3d0e414cffd44a6323e2
parentb3e9211e48a3fb586e88b0270a175d2348935424 (diff)
downloadmariadb-git-83d20ca3fbab4ffa160fd3554e9e36a868fb2ab1.tar.gz
-rw-r--r--storage/myisam/ft_boolean_search.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/storage/myisam/ft_boolean_search.c b/storage/myisam/ft_boolean_search.c
index a9ce4436025..fc8713f0d32 100644
--- a/storage/myisam/ft_boolean_search.c
+++ b/storage/myisam/ft_boolean_search.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 2001, 2011, Oracle and/or its affiliates. All rights reserved.
+/* Copyright (c) 2001, 2016, Oracle and/or its affiliates. All rights reserved.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -199,7 +199,8 @@ static int ftb_query_add_word(MYSQL_FTPARSER_PARAM *param,
ftbw= (FTB_WORD *)alloc_root(&ftb_param->ftb->mem_root,
sizeof(FTB_WORD) +
(info->trunc ? MI_MAX_KEY_BUFF :
- word_len * ftb_param->ftb->charset->mbmaxlen +
+ (word_len + 1) *
+ ftb_param->ftb->charset->mbmaxlen +
HA_FT_WLEN +
ftb_param->ftb->info->s->rec_reflength));
ftbw->len= word_len + 1;
@@ -362,6 +363,8 @@ static int _ft2_search_no_lock(FTB *ftb, FTB_WORD *ftbw, my_bool init_search)
MI_INFO *info=ftb->info;
uint UNINIT_VAR(off), extra= HA_FT_WLEN + info->s->rec_reflength;
uchar *lastkey_buf=ftbw->word+ftbw->off;
+ uint max_word_length= (ftbw->flags & FTB_FLAG_TRUNC) ? MI_MAX_KEY_BUFF :
+ ((ftbw->len) * ftb->charset->mbmaxlen) + extra;
if (ftbw->flags & FTB_FLAG_TRUNC)
lastkey_buf+=ftbw->len;
@@ -421,7 +424,7 @@ static int _ft2_search_no_lock(FTB *ftb, FTB_WORD *ftbw, my_bool init_search)
(my_bool) (ftbw->flags & FTB_FLAG_TRUNC),0);
}
- if (r) /* not found */
+ if (r || info->lastkey_length > max_word_length) /* not found */
{
if (!ftbw->off || !(ftbw->flags & FTB_FLAG_TRUNC))
{