Merge lp:~laurynas-biveinis/percona-server/bug905711 into lp:percona-server/5.1

Proposed by Laurynas Biveinis
Status: Merged
Approved by: Alexey Kopytov
Approved revision: no longer in the source branch.
Merged at revision: 413
Proposed branch: lp:~laurynas-biveinis/percona-server/bug905711
Merge into: lp:percona-server/5.1
Prerequisite: lp:~laurynas-biveinis/percona-server/bug902467
Diff against target: 51 lines (+16/-2)
3 files modified
Percona-Server/mysql-test/r/bug63793.result (+5/-0)
Percona-Server/mysql-test/t/bug63793.test (+9/-0)
Percona-Server/sql/sql_select.cc (+2/-2)
To merge this branch: bzr merge lp:~laurynas-biveinis/percona-server/bug905711
Reviewer Review Type Date Requested Status
Alexey Kopytov (community) Approve
Review via email: mp+86316@code.launchpad.net

Description of the change

Fix bug 905711: Crash in DTCollation::set(DTCollation &set), upstream
63793.

The cause and the fix are the same as for upstream 53236 (except that
that testcase does not trigger the crash): don't call member functions
with this == NULL in sql_select.cc:change_cond_ref_to_const. If
clone_item() returns NULL, then there is no need to set the
collation.

Add new testcase bug63793.

To post a comment you must log in.
Revision history for this message
Alexey Kopytov (akopytov) wrote :

Looks good to me except that if I saw the 'backport' word somewhere in the revision/MP comments, figuring out what the patch is would be a no-op. But that's a minor thing, feel free to ignore.

review: Approve
Revision history for this message
Laurynas Biveinis (laurynas-biveinis) wrote :

Alexey -

Thanks. I was cautious about saying "backport", as the the original testcase passes on 5.1 already and this one has a new testcase.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== added file 'Percona-Server/mysql-test/r/bug63793.result'
--- Percona-Server/mysql-test/r/bug63793.result 1970-01-01 00:00:00 +0000
+++ Percona-Server/mysql-test/r/bug63793.result 2011-12-20 01:52:25 +0000
@@ -0,0 +1,5 @@
1DROP TABLE IF EXISTS t1;
2CREATE TABLE t1 (a VARCHAR(50));
3SELECT a FROM t1 WHERE CAST(a as binary)=x'62736D697468' AND CAST(a AS BINARY)=x'65736D697468';
4a
5DROP TABLE t1;
06
=== added file 'Percona-Server/mysql-test/t/bug63793.test'
--- Percona-Server/mysql-test/t/bug63793.test 1970-01-01 00:00:00 +0000
+++ Percona-Server/mysql-test/t/bug63793.test 2011-12-20 01:52:25 +0000
@@ -0,0 +1,9 @@
1--disable_warnings
2DROP TABLE IF EXISTS t1;
3--enable_warnings
4
5CREATE TABLE t1 (a VARCHAR(50));
6
7SELECT a FROM t1 WHERE CAST(a as binary)=x'62736D697468' AND CAST(a AS BINARY)=x'65736D697468';
8
9DROP TABLE t1;
010
=== modified file 'Percona-Server/sql/sql_select.cc'
--- Percona-Server/sql/sql_select.cc 2011-11-24 16:33:30 +0000
+++ Percona-Server/sql/sql_select.cc 2011-12-20 01:52:25 +0000
@@ -8580,10 +8580,10 @@
8580 left_item->collation.collation == value->collation.collation))8580 left_item->collation.collation == value->collation.collation))
8581 {8581 {
8582 Item *tmp=value->clone_item();8582 Item *tmp=value->clone_item();
8583 tmp->collation.set(right_item->collation);
8584 8583
8585 if (tmp)8584 if (tmp)
8586 {8585 {
8586 tmp->collation.set(right_item->collation);
8587 thd->change_item_tree(args + 1, tmp);8587 thd->change_item_tree(args + 1, tmp);
8588 func->update_used_tables();8588 func->update_used_tables();
8589 if ((functype == Item_func::EQ_FUNC || functype == Item_func::EQUAL_FUNC)8589 if ((functype == Item_func::EQ_FUNC || functype == Item_func::EQUAL_FUNC)
@@ -8604,10 +8604,10 @@
8604 right_item->collation.collation == value->collation.collation))8604 right_item->collation.collation == value->collation.collation))
8605 {8605 {
8606 Item *tmp= value->clone_item();8606 Item *tmp= value->clone_item();
8607 tmp->collation.set(left_item->collation);
8608 8607
8609 if (tmp)8608 if (tmp)
8610 {8609 {
8610 tmp->collation.set(left_item->collation);
8611 thd->change_item_tree(args, tmp);8611 thd->change_item_tree(args, tmp);
8612 value= tmp;8612 value= tmp;
8613 func->update_used_tables();8613 func->update_used_tables();

Subscribers

People subscribed via source and target branches