diff options
author | unknown <petr@mysql.com> | 2005-11-05 15:08:15 +0300 |
---|---|---|
committer | unknown <petr@mysql.com> | 2005-11-05 15:08:15 +0300 |
commit | 1b65c7041383073eee99deebe8569399f06e83ee (patch) | |
tree | a6335f069379fe5794cf0e612aec3dac43c25755 /sql/examples | |
parent | 57923440f3711dd6287df9d8f54e94b9031c7ec0 (diff) | |
download | mariadb-git-1b65c7041383073eee99deebe8569399f06e83ee.tar.gz |
Fix Bug#13894 Server crashes on update of CSV table
mysql-test/r/csv.result:
update result file
mysql-test/t/csv.test:
Add test for a bug
sql/examples/ha_tina.cc:
sort function should return reverted values for chains to be sorted in
the right orded. don't do a strange memmove
Diffstat (limited to 'sql/examples')
-rw-r--r-- | sql/examples/ha_tina.cc | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/sql/examples/ha_tina.cc b/sql/examples/ha_tina.cc index 8a9aa91c680..f4544670ed9 100644 --- a/sql/examples/ha_tina.cc +++ b/sql/examples/ha_tina.cc @@ -58,12 +58,16 @@ static int tina_init= 0; ** TINA tables *****************************************************************************/ -/* - Used for sorting chains. +/* + Used for sorting chains with qsort(). */ int sort_set (tina_set *a, tina_set *b) { - return ( a->begin > b->begin ? 1 : ( a->begin < b->begin ? -1 : 0 ) ); + /* + We assume that intervals do not intersect. So, it is enought to compare + any two points. Here we take start of intervals for comparison. + */ + return ( a->begin > b->begin ? -1 : ( a->begin < b->begin ? 1 : 0 ) ); } static byte* tina_get_key(TINA_SHARE *share,uint *length, @@ -739,13 +743,8 @@ int ha_tina::rnd_end() qsort(chain, (size_t)(chain_ptr - chain), sizeof(tina_set), (qsort_cmp)sort_set); for (ptr= chain; ptr < chain_ptr; ptr++) { - /* We peek a head to see if this is the last chain */ - if (ptr+1 == chain_ptr) - memmove(share->mapped_file + ptr->begin, share->mapped_file + ptr->end, - length - (size_t)ptr->end); - else - memmove((caddr_t)share->mapped_file + ptr->begin, (caddr_t)share->mapped_file + ptr->end, - (size_t)((ptr++)->begin - ptr->end)); + memmove(share->mapped_file + ptr->begin, share->mapped_file + ptr->end, + length - (size_t)ptr->end); length= length - (size_t)(ptr->end - ptr->begin); } |