diff options
author | Sergey Glukhov <gluh@mysql.com> | 2008-08-20 14:49:28 +0500 |
---|---|---|
committer | Sergey Glukhov <gluh@mysql.com> | 2008-08-20 14:49:28 +0500 |
commit | de73b729543f40f46463c0134e380057ee4adb27 (patch) | |
tree | cfab6f009ae2b2b34b94467246a6fd6ca9fbe055 /mysql-test | |
parent | 40bd9a42183146253018c50fe213ba60c77b4dc1 (diff) | |
download | mariadb-git-de73b729543f40f46463c0134e380057ee4adb27.tar.gz |
Bug#38291 memory corruption and server crash with view/sp/function
Send_field.org_col_name has broken value on secondary execution.
It happens when result field is created from the field which belongs to view
due to forgotten assignment of some Send_field attributes.
The fix:
set Send_field.org_col_name,org_table_name with correct value during Send_field intialization.
mysql-test/r/metadata.result:
result fix
The result file was changed because now forgotten attributes are properly set.
mysql-test/r/sp.result:
test result
mysql-test/t/sp.test:
test case
sql/item.cc:
Send_field.org_col_name has broken value on secondary execution.
It happens when result field is created from the field which belongs to view
due to forgotten assignment of some Send_field attributes.
The fix:
set Send_field.org_col_name,org_table_name with correct value during Send_field intialization.
tests/mysql_client_test.c:
test case fix
The test was changed because now forgotten attributes are properly set.
Diffstat (limited to 'mysql-test')
-rw-r--r-- | mysql-test/r/metadata.result | 10 | ||||
-rw-r--r-- | mysql-test/r/sp.result | 16 | ||||
-rw-r--r-- | mysql-test/t/sp.test | 24 |
3 files changed, 45 insertions, 5 deletions
diff --git a/mysql-test/r/metadata.result b/mysql-test/r/metadata.result index 4a776b6a253..a4b6fd2ce8f 100644 --- a/mysql-test/r/metadata.result +++ b/mysql-test/r/metadata.result @@ -108,11 +108,11 @@ id 1 select * from v1 group by id limit 0; Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr -def test t1 v1 id id 3 10 0 Y 32768 0 63 +def test v1 v1 id id 3 10 0 Y 32768 0 63 id select * from v1 where id=1000 group by id; Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr -def test t1 v1 id id 3 10 0 Y 32768 0 63 +def test v1 v1 id id 3 10 0 Y 32768 0 63 id select * from v1 where id=1 group by id; Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr @@ -126,7 +126,7 @@ renamed 1 select * from v3 where renamed=1 group by renamed; Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr -def v3 renamed 8 12 0 Y 32896 0 63 +def v3 v3 renamed renamed 8 12 0 Y 32896 0 63 renamed drop table t1; drop view v1,v2,v3; @@ -156,8 +156,8 @@ c1 3 SELECT v1.c1, v2.c2 FROM v1 JOIN v2 ON c1=c2; Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr -def test t1 v1 c1 c1 254 1 1 Y 0 0 8 -def test t2 v2 c2 c2 254 1 1 Y 0 0 8 +def test v1 v1 c1 c1 254 1 1 Y 0 0 8 +def test v2 v2 c2 c2 254 1 1 Y 0 0 8 c1 c2 1 1 2 2 diff --git a/mysql-test/r/sp.result b/mysql-test/r/sp.result index 562102f0ea7..be21251d92e 100644 --- a/mysql-test/r/sp.result +++ b/mysql-test/r/sp.result @@ -6646,6 +6646,22 @@ ttt 2 drop function func30787; drop table t1; +create table t1(c1 INT); +create function f1(p1 int) returns varchar(32) +return 'aaa'; +create view v1 as select f1(c1) as parent_control_name from t1; +create procedure p1() +begin +select parent_control_name as c1 from v1; +end // +call p1(); +c1 +call p1(); +c1 +drop procedure p1; +drop function f1; +drop view v1; +drop table t1; # ------------------------------------------------------------------ # -- End of 5.0 tests # ------------------------------------------------------------------ diff --git a/mysql-test/t/sp.test b/mysql-test/t/sp.test index 48ef51e09aa..87ab1d2f0d9 100644 --- a/mysql-test/t/sp.test +++ b/mysql-test/t/sp.test @@ -7794,6 +7794,30 @@ drop function func30787; drop table t1; +# +# Bug#38291 memory corruption and server crash with view/sp/function +# + +create table t1(c1 INT); +create function f1(p1 int) returns varchar(32) + return 'aaa'; +create view v1 as select f1(c1) as parent_control_name from t1; + +delimiter //; +create procedure p1() +begin + select parent_control_name as c1 from v1; +end // +delimiter ;// + +call p1(); +call p1(); + +drop procedure p1; +drop function f1; +drop view v1; +drop table t1; + --echo # ------------------------------------------------------------------ --echo # -- End of 5.0 tests --echo # ------------------------------------------------------------------ |