summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorunknown <svoj@mysql.com>2005-08-02 11:33:26 +0500
committerunknown <svoj@mysql.com>2005-08-02 11:33:26 +0500
commit451ec64db9acb6c4a590b64b5077ca72041e6cdf (patch)
treed35146d5534ba1ad93f78c35387181ac248a257b
parent90e41facf78150df4f8d387f6d44647957c7a8a0 (diff)
downloadmariadb-git-451ec64db9acb6c4a590b64b5077ca72041e6cdf.tar.gz
BUG#11684 fix.
Repair crashes mysql when table has fulltext index. myisam/sort.c: Use static ft_buf instead of dynamic mergebuf. Latter could be NULL if record has long words. mysql-test/r/fulltext.result: Test case for BUG#11684 - repair crashes mysql when table has fulltext index. mysql-test/t/fulltext.test: Test case for BUG#11684 - repair crashes mysql when table has fulltext index.
-rw-r--r--myisam/sort.c14
-rw-r--r--mysql-test/r/fulltext.result8
-rw-r--r--mysql-test/t/fulltext.test11
3 files changed, 27 insertions, 6 deletions
diff --git a/myisam/sort.c b/myisam/sort.c
index 95ede6ddaa1..45a670c3f6b 100644
--- a/myisam/sort.c
+++ b/myisam/sort.c
@@ -532,13 +532,15 @@ int thr_write_keys(MI_SORT_PARAM *sort_param)
while (!got_error &&
!my_b_read(&sinfo->tempfile_for_exceptions,(byte*)&key_length,
- sizeof(key_length)) &&
- !my_b_read(&sinfo->tempfile_for_exceptions,(byte*)mergebuf,
- (uint) key_length))
+ sizeof(key_length)))
{
- if (_mi_ck_write(info,sinfo->key,(uchar*) mergebuf,
- key_length - info->s->rec_reflength))
- got_error=1;
+ byte ft_buf[HA_FT_MAXLEN + HA_FT_WLEN + 10];
+ if (key_length > sizeof(ft_buf) ||
+ my_b_read(&sinfo->tempfile_for_exceptions, (byte*)ft_buf,
+ (uint)key_length) ||
+ _mi_ck_write(info, sinfo->key, (uchar*)ft_buf,
+ key_length - info->s->rec_reflength))
+ got_error=1;
}
}
}
diff --git a/mysql-test/r/fulltext.result b/mysql-test/r/fulltext.result
index ce1703fca0e..c94a9bbee85 100644
--- a/mysql-test/r/fulltext.result
+++ b/mysql-test/r/fulltext.result
@@ -321,3 +321,11 @@ SELECT MATCH(a) AGAINST ('nosuchword') FROM t1;
MATCH(a) AGAINST ('nosuchword')
0
DROP TABLE t1;
+CREATE TABLE t1 (a VARCHAR(30), FULLTEXT(a));
+INSERT INTO t1 VALUES('bbbbbbbbbbbbbbbbbbbbbbbbbbbbbb');
+SET myisam_repair_threads=2;
+REPAIR TABLE t1;
+Table Op Msg_type Msg_text
+test.t1 repair status OK
+SET myisam_repair_threads=@@global.myisam_repair_threads;
+DROP TABLE t1;
diff --git a/mysql-test/t/fulltext.test b/mysql-test/t/fulltext.test
index 90020e9468e..f9f61bb14a0 100644
--- a/mysql-test/t/fulltext.test
+++ b/mysql-test/t/fulltext.test
@@ -260,3 +260,14 @@ CREATE TABLE t1 ( a TEXT, FULLTEXT (a) );
INSERT INTO t1 VALUES ('testing ft_nlq_find_relevance');
SELECT MATCH(a) AGAINST ('nosuchword') FROM t1;
DROP TABLE t1;
+
+#
+# BUG#11684 - repair crashes mysql when table has fulltext index
+#
+
+CREATE TABLE t1 (a VARCHAR(30), FULLTEXT(a));
+INSERT INTO t1 VALUES('bbbbbbbbbbbbbbbbbbbbbbbbbbbbbb');
+SET myisam_repair_threads=2;
+REPAIR TABLE t1;
+SET myisam_repair_threads=@@global.myisam_repair_threads;
+DROP TABLE t1;