Skip to content

Commit 7438667

Browse files
committed
MDEV-9137 MariaDB Crash on Query Using Aria Engine
update the code to match semantics of `key` - it's not a (char*) pointer to the buffer as in MyISAM.
1 parent 3d65d0d commit 7438667

File tree

3 files changed

+13
-5
lines changed

3 files changed

+13
-5
lines changed

mysql-test/suite/maria/fulltext2.result

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,5 @@ test.t1 check status OK
1818
repair table t1;
1919
Table Op Msg_type Msg_text
2020
test.t1 repair status OK
21+
insert t1 (a) values ('aaaxxx'),('aaayyy');
2122
drop table t1;

mysql-test/suite/maria/fulltext2.test

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,5 +39,7 @@ repair table t1;
3939
check table t1;
4040
repair table t1;
4141

42+
# mi_write:
43+
insert t1 (a) values ('aaaxxx'),('aaayyy');
4244

4345
drop table t1;

storage/maria/ma_write.c

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -665,13 +665,18 @@ static int w_search(register MARIA_HA *info, uint32 comp_flag, MARIA_KEY *key,
665665
else
666666
{
667667
/* popular word. two-level tree. going down */
668-
my_off_t root=dup_key_pos;
669-
keyinfo= &share->ft2_keyinfo;
670-
get_key_full_length_rdonly(off, key);
671-
key+=off;
668+
my_off_t root= dup_key_pos;
669+
MARIA_KEY subkey;
670+
get_key_full_length_rdonly(off, key->data);
671+
subkey.keyinfo= keyinfo= &share->ft2_keyinfo;
672+
subkey.data= key->data + off;
673+
subkey.data_length= key->data_length - off;
674+
subkey.ref_length= key->ref_length;
675+
subkey.flag= key->flag;
676+
672677
/* we'll modify key entry 'in vivo' */
673678
keypos-= keyinfo->keylength + page.node;
674-
error= _ma_ck_real_write_btree(info, key, &root, comp_flag);
679+
error= _ma_ck_real_write_btree(info, &subkey, &root, comp_flag);
675680
_ma_dpointer(share, keypos+HA_FT_WLEN, root);
676681
subkeys--; /* should there be underflow protection ? */
677682
DBUG_ASSERT(subkeys < 0);

0 commit comments

Comments
 (0)