Commit f3eb021d authored by Tor Didriksen's avatar Tor Didriksen

Bug#13519724 63793: CRASH IN DTCOLLATION::SET(DTCOLLATION &SET)

Backport of fix for:
Bug#53236 Segfault in DTCollation::set(DTCollation&)
parent b79d492e
...@@ -468,4 +468,13 @@ NULL ...@@ -468,4 +468,13 @@ NULL
Warnings: Warnings:
Warning 1301 Result of cast_as_char() was larger than max_allowed_packet (2048) - truncated Warning 1301 Result of cast_as_char() was larger than max_allowed_packet (2048) - truncated
SET @@GLOBAL.max_allowed_packet=default; SET @@GLOBAL.max_allowed_packet=default;
#
# Bug#13519724 63793: CRASH IN DTCOLLATION::SET(DTCOLLATION &SET)
#
CREATE TABLE t1 (a VARCHAR(50));
SELECT a FROM t1
WHERE CAST(a as BINARY)=x'62736D697468'
AND CAST(a AS BINARY)=x'65736D697468';
a
DROP TABLE t1;
End of 5.1 tests End of 5.1 tests
...@@ -297,4 +297,16 @@ connection default; ...@@ -297,4 +297,16 @@ connection default;
disconnect newconn; disconnect newconn;
SET @@GLOBAL.max_allowed_packet=default; SET @@GLOBAL.max_allowed_packet=default;
--echo #
--echo # Bug#13519724 63793: CRASH IN DTCOLLATION::SET(DTCOLLATION &SET)
--echo #
CREATE TABLE t1 (a VARCHAR(50));
SELECT a FROM t1
WHERE CAST(a as BINARY)=x'62736D697468'
AND CAST(a AS BINARY)=x'65736D697468';
DROP TABLE t1;
--echo End of 5.1 tests --echo End of 5.1 tests
...@@ -8546,10 +8546,10 @@ change_cond_ref_to_const(THD *thd, I_List<COND_CMP> *save_list, ...@@ -8546,10 +8546,10 @@ change_cond_ref_to_const(THD *thd, I_List<COND_CMP> *save_list,
left_item->collation.collation == value->collation.collation)) left_item->collation.collation == value->collation.collation))
{ {
Item *tmp=value->clone_item(); Item *tmp=value->clone_item();
tmp->collation.set(right_item->collation);
if (tmp) if (tmp)
{ {
tmp->collation.set(right_item->collation);
thd->change_item_tree(args + 1, tmp); thd->change_item_tree(args + 1, tmp);
func->update_used_tables(); func->update_used_tables();
if ((functype == Item_func::EQ_FUNC || functype == Item_func::EQUAL_FUNC) if ((functype == Item_func::EQ_FUNC || functype == Item_func::EQUAL_FUNC)
...@@ -8570,10 +8570,10 @@ change_cond_ref_to_const(THD *thd, I_List<COND_CMP> *save_list, ...@@ -8570,10 +8570,10 @@ change_cond_ref_to_const(THD *thd, I_List<COND_CMP> *save_list,
right_item->collation.collation == value->collation.collation)) right_item->collation.collation == value->collation.collation))
{ {
Item *tmp= value->clone_item(); Item *tmp= value->clone_item();
tmp->collation.set(left_item->collation);
if (tmp) if (tmp)
{ {
tmp->collation.set(left_item->collation);
thd->change_item_tree(args, tmp); thd->change_item_tree(args, tmp);
value= tmp; value= tmp;
func->update_used_tables(); func->update_used_tables();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment