|
|||||||||||
|
bk commit into 5.1 tree (mattiasj:1.2568) BUG#30695
From: <mattiasj(at)mysql.com>
Date: Wed Oct 10 2007 - 14:53:35 EDT
ChangeSet@1.2568, 2007-10-10 20:53:29+02:00, mattiasj@mattiasj-laptop.(none) +4 -0 Bug #30695: An apostrophe ' in the comment of the ADD PARTITION causes the Server to crash. Crashed because of the comment in the partition clause was saved in the frm file without escaping, causing the server to crash when it was read/parsed again. Fixed by escaping quoted text in the partition info when writing it to the frm-file and added a check that it was able to parse the partition info before using it NOTE: If the comment is written by an earlier version of the server, the corrupted frm-file is still corrupt, drop the table and recreate it. (If needed, edit the frm-file manually and replace the apostrophe within the comment with a space to allow parsing)
mysql-test/r/partition.result@1.69, 2007-10-10 20:53:27+02:00, mattiasj@mattiasj-laptop.(none) +16 -0
bug #30695: An apostrophe ' in the comment of the ADD PARTITION causes
the Server to crash.
mysql-test/t/partition.test@1.63, 2007-10-10 20:53:27+02:00, mattiasj@mattiasj-laptop.(none) +26 -0
bug #30695: An apostrophe ' in the comment of the ADD PARTITION causes
the Server to crash.
sql/sql_partition.cc@1.116, 2007-10-10 20:53:28+02:00, mattiasj@mattiasj-laptop.(none) +17 -4 Bug #30695: An apostrophe ' in the comment of the ADD PARTITION causes the Server to crash. Crashes when there is an non escaped apostrophe in the partition comment fixed by escaping quoted text before writing to the frm-file sql/table.cc@1.312, 2007-10-10 20:53:28+02:00, mattiasj@mattiasj-laptop.(none) +2 -1 Bug #30695 An apostrophe ' in the comment of the ADD PARTITION causes the Server to crash problem was using a null poiter without check -> crash. added a check that the previus call succeded diff -Nrup a/mysql-test/r/partition.result b/mysql-test/r/partition.result --- a/mysql-test/r/partition.result 2007-07-02 20:11:52 +02:00@@ -1,4 +1,20 @@ drop table if exists t1; +CREATE TABLE t1 ( +d DATE NOT NULL +) +PARTITION BY RANGE( YEAR(d) ) ( +PARTITION p0 VALUES LESS THAN (1960), +PARTITION p1 VALUES LESS THAN (1970), +PARTITION p2 VALUES LESS THAN (1980), +PARTITION p3 VALUES LESS THAN (1990) +); +ALTER TABLE t1 ADD PARTITION ( +PARTITION `p5` VALUES LESS THAN (2010) +COMMENT 'APSTART \' APEND' +); +SELECT * FROM t1 LIMIT 1; +d +DROP TABLE t1; create table t1 (a int) partition by key(a) partitions 0.2+e1; diff -Nrup a/mysql-test/t/partition.test b/mysql-test/t/partition.test --- a/mysql-test/t/partition.test 2007-07-02 20:11:52 +02:00@@ -10,6 +10,32 @@ drop table if exists t1; --enable_warnings #+# To verify the fix for crashing (on unix-type OS) +# uncomment the exec and error rows! + +CREATE TABLE t1 ( + d DATE NOT NULL +) +PARTITION BY RANGE( YEAR(d) ) ( + PARTITION p0 VALUES LESS THAN (1960), + PARTITION p1 VALUES LESS THAN (1970), + PARTITION p2 VALUES LESS THAN (1980), + PARTITION p3 VALUES LESS THAN (1990) +); + +ALTER TABLE t1 ADD PARTITION ( +PARTITION `p5` VALUES LESS THAN (2010) +COMMENT 'APSTART \' APEND' +); +#--exec sed 's/APSTART \\/APSTART /' var/master-data/test/t1.frm > tmpt1.frm && mv tmpt1.frm var/master-data/test/t1.frm +#--error 1064 +SELECT * FROM t1 LIMIT 1; + +DROP TABLE t1; + +# # Bug 15890: Strange number of partitions accepted #
+/*
bool should_use_quotes,
const char *keystr)
@@ -1859,10 +1873,9 @@ static int add_keyword_string(File fptr,
err+= add_equal(fptr);
- err+= add_string(fptr, "'"); - err+= add_string(fptr, keystr); - if (should_use_quotes) - err+= add_string(fptr, "'"); + err+= add_quoted_string(fptr, keystr); + else + err+= add_string(fptr, keystr);
return err + add_space(fptr);
diff -Nrup a/sql/table.cc b/sql/table.cc --- a/sql/table.cc 2007-08-31 11:55:53 +02:00- outparam->part_info->is_auto_partitioned= share->auto_partitioned; + if (!tmp) + outparam->part_info->is_auto_partitioned= share->auto_partitioned;
DBUG_PRINT("info", ("autopartitioned: %u", share->auto_partitioned));
/* we should perform the fix_partition_func in either local or
caller's arena depending on work_part_info_used value
-- MySQL Code Commits Mailing List For list archives: http://lists.mysql.com/commits To unsubscribe: http://lists.mysql.com/commits?unsub=lists@pantek.comReceived on Wed Oct 10 14:53:57 2007 This archive was generated by hypermail 2.1.8 : Thu Jul 03 2008 - 09:40:45 EDT |
||||||||||
|
|||||||||||