summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOleksandr Byelkin <sanja@mariadb.com>2018-01-10 12:22:56 +0100
committerOleksandr Byelkin <sanja@mariadb.com>2018-01-10 12:22:56 +0100
commit4b4267288cb2668717cc70537eb7e79cecaff58a (patch)
treef0d3621bbdbb84bcb3ae32e102f7172d44071c06
parenta408e881cf73d06fc92097fce6ef9584e16edf77 (diff)
downloadmariadb-git-bb-5.5-MDEV-14743.tar.gz
MDEV-14743: Server crashes in Item_func_match::init_searchbb-5.5-MDEV-14743
Remove non prepared (and so belonging to removed clauses FT functions) from the list. in later version it will be fixed by building the list during preparation.
-rw-r--r--mysql-test/r/fulltext.result9
-rw-r--r--mysql-test/t/fulltext.test12
-rw-r--r--sql/sql_base.cc14
3 files changed, 34 insertions, 1 deletions
diff --git a/mysql-test/r/fulltext.result b/mysql-test/r/fulltext.result
index ad93bfcd462..e5302f2e92d 100644
--- a/mysql-test/r/fulltext.result
+++ b/mysql-test/r/fulltext.result
@@ -742,5 +742,14 @@ txt1 txt2
nnn2 x2 y2 ööö2 mmm2 ùùù2
DROP TABLE t1;
#
+# MDEV-14743: Server crashes in Item_func_match::init_search
+#
+CREATE TABLE t1 (f VARCHAR(8));
+INSERT INTO t1 VALUES ('foo'),('bar');
+SELECT 'foo' IN ( SELECT f FROM t1 GROUP BY MATCH(f) AGAINST ( 'qux' IN BOOLEAN MODE ) );
+'foo' IN ( SELECT f FROM t1 GROUP BY MATCH(f) AGAINST ( 'qux' IN BOOLEAN MODE ) )
+1
+drop table t1;
+#
# End of 5.5 tests
#
diff --git a/mysql-test/t/fulltext.test b/mysql-test/t/fulltext.test
index f7c7eb20a0c..40e9524e01e 100644
--- a/mysql-test/t/fulltext.test
+++ b/mysql-test/t/fulltext.test
@@ -682,6 +682,18 @@ SELECT * FROM t1 WHERE MATCH (txt1,txt2) AGAINST ('ööö1' IN BOOLEAN MODE);
SELECT * FROM t1 WHERE MATCH (txt1,txt2) AGAINST ('ùùù2' IN BOOLEAN MODE);
DROP TABLE t1;
+
+--echo #
+--echo # MDEV-14743: Server crashes in Item_func_match::init_search
+--echo #
+
+CREATE TABLE t1 (f VARCHAR(8));
+INSERT INTO t1 VALUES ('foo'),('bar');
+
+SELECT 'foo' IN ( SELECT f FROM t1 GROUP BY MATCH(f) AGAINST ( 'qux' IN BOOLEAN MODE ) );
+
+drop table t1;
+
--echo #
--echo # End of 5.5 tests
--echo #
diff --git a/sql/sql_base.cc b/sql/sql_base.cc
index c06c4fcff29..26e302ded35 100644
--- a/sql/sql_base.cc
+++ b/sql/sql_base.cc
@@ -9550,7 +9550,19 @@ int init_ftfuncs(THD *thd, SELECT_LEX *select_lex, bool no_order)
DBUG_PRINT("info",("Performing FULLTEXT search"));
while ((ifm=li++))
- ifm->init_search(no_order);
+#if MYSQL_VERSION_ID < 100213
+ if (ifm->fixed)
+#endif
+ ifm->init_search(no_order);
+#if MYSQL_VERSION_ID < 100213
+ else
+ /*
+ it mean that clause where was FT function was removed, so we have
+ to remove the function from the list.
+ */
+ li.remove();
+#endif
+
}
return 0;
}