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
1=== added file 'Percona-Server/mysql-test/r/bug63793.result'
2--- Percona-Server/mysql-test/r/bug63793.result 1970-01-01 00:00:00 +0000
3+++ Percona-Server/mysql-test/r/bug63793.result 2011-12-20 01:52:25 +0000
4@@ -0,0 +1,5 @@
5+DROP TABLE IF EXISTS t1;
6+CREATE TABLE t1 (a VARCHAR(50));
7+SELECT a FROM t1 WHERE CAST(a as binary)=x'62736D697468' AND CAST(a AS BINARY)=x'65736D697468';
8+a
9+DROP TABLE t1;
10
11=== added file 'Percona-Server/mysql-test/t/bug63793.test'
12--- Percona-Server/mysql-test/t/bug63793.test 1970-01-01 00:00:00 +0000
13+++ Percona-Server/mysql-test/t/bug63793.test 2011-12-20 01:52:25 +0000
14@@ -0,0 +1,9 @@
15+--disable_warnings
16+DROP TABLE IF EXISTS t1;
17+--enable_warnings
18+
19+CREATE TABLE t1 (a VARCHAR(50));
20+
21+SELECT a FROM t1 WHERE CAST(a as binary)=x'62736D697468' AND CAST(a AS BINARY)=x'65736D697468';
22+
23+DROP TABLE t1;
24
25=== modified file 'Percona-Server/sql/sql_select.cc'
26--- Percona-Server/sql/sql_select.cc 2011-11-24 16:33:30 +0000
27+++ Percona-Server/sql/sql_select.cc 2011-12-20 01:52:25 +0000
28@@ -8580,10 +8580,10 @@
29 left_item->collation.collation == value->collation.collation))
30 {
31 Item *tmp=value->clone_item();
32- tmp->collation.set(right_item->collation);
33
34 if (tmp)
35 {
36+ tmp->collation.set(right_item->collation);
37 thd->change_item_tree(args + 1, tmp);
38 func->update_used_tables();
39 if ((functype == Item_func::EQ_FUNC || functype == Item_func::EQUAL_FUNC)
40@@ -8604,10 +8604,10 @@
41 right_item->collation.collation == value->collation.collation))
42 {
43 Item *tmp= value->clone_item();
44- tmp->collation.set(left_item->collation);
45
46 if (tmp)
47 {
48+ tmp->collation.set(left_item->collation);
49 thd->change_item_tree(args, tmp);
50 value= tmp;
51 func->update_used_tables();

Subscribers

People subscribed via source and target branches