Loading mysql-test/r/sp-error.result +7 −0 Original line number Diff line number Diff line Loading @@ -1513,3 +1513,10 @@ end loop label1; end loop; end| ERROR 42000: End-label label1 without match CREATE TABLE t1 (a INT)| INSERT INTO t1 VALUES (1),(2)| CREATE PROCEDURE p1(a INT) BEGIN END| CALL p1((SELECT * FROM t1))| ERROR 21000: Subquery returns more than 1 row DROP PROCEDURE IF EXISTS p1| DROP TABLE t1| mysql-test/r/sp.result +10 −0 Original line number Diff line number Diff line Loading @@ -6662,6 +6662,16 @@ drop procedure p1; drop function f1; drop view v1; drop table t1; drop procedure if exists `p2` $ create procedure `p2`(in `a` text charset utf8) begin declare `pos` int default 1; declare `str` text charset utf8; set `str` := `a`; select substr(`str`, `pos`+ 1 ) into `str`; end $ call `p2`('s s s s s s'); drop procedure `p2`; # ------------------------------------------------------------------ # -- End of 5.0 tests # ------------------------------------------------------------------ mysql-test/t/sp-error.test +8 −0 Original line number Diff line number Diff line Loading @@ -2173,6 +2173,14 @@ begin end loop; end| CREATE TABLE t1 (a INT)| INSERT INTO t1 VALUES (1),(2)| CREATE PROCEDURE p1(a INT) BEGIN END| --error ER_SUBQUERY_NO_1_ROW CALL p1((SELECT * FROM t1))| DROP PROCEDURE IF EXISTS p1| DROP TABLE t1| delimiter ;| # Loading mysql-test/t/sp.test +18 −0 Original line number Diff line number Diff line Loading @@ -7818,6 +7818,24 @@ drop function f1; drop view v1; drop table t1; # # Bug#38469 invalid memory read and/or crash with utf8 text field, stored procedure, uservar # delimiter $; --disable_warnings drop procedure if exists `p2` $ --enable_warnings create procedure `p2`(in `a` text charset utf8) begin declare `pos` int default 1; declare `str` text charset utf8; set `str` := `a`; select substr(`str`, `pos`+ 1 ) into `str`; end $ delimiter ;$ call `p2`('s s s s s s'); drop procedure `p2`; --echo # ------------------------------------------------------------------ --echo # -- End of 5.0 tests --echo # ------------------------------------------------------------------ sql/field.cc +11 −1 Original line number Diff line number Diff line Loading @@ -6992,8 +6992,18 @@ int Field_blob::store(const char *from,uint length,CHARSET_INFO *cs) return 0; } if (from == value.ptr()) /* If the 'from' address is in the range of the temporary 'value'- object we need to copy the content to a different location or it will be invalidated when the 'value'-object is reallocated to make room for the new character set. */ if (from >= value.ptr() && from <= value.ptr()+value.length()) { /* If content of the 'from'-address is cached in the 'value'-object it is possible that the content needs a character conversion. */ uint32 dummy_offset; if (!String::needs_conversion(length, cs, field_charset, &dummy_offset)) { Loading Loading
mysql-test/r/sp-error.result +7 −0 Original line number Diff line number Diff line Loading @@ -1513,3 +1513,10 @@ end loop label1; end loop; end| ERROR 42000: End-label label1 without match CREATE TABLE t1 (a INT)| INSERT INTO t1 VALUES (1),(2)| CREATE PROCEDURE p1(a INT) BEGIN END| CALL p1((SELECT * FROM t1))| ERROR 21000: Subquery returns more than 1 row DROP PROCEDURE IF EXISTS p1| DROP TABLE t1|
mysql-test/r/sp.result +10 −0 Original line number Diff line number Diff line Loading @@ -6662,6 +6662,16 @@ drop procedure p1; drop function f1; drop view v1; drop table t1; drop procedure if exists `p2` $ create procedure `p2`(in `a` text charset utf8) begin declare `pos` int default 1; declare `str` text charset utf8; set `str` := `a`; select substr(`str`, `pos`+ 1 ) into `str`; end $ call `p2`('s s s s s s'); drop procedure `p2`; # ------------------------------------------------------------------ # -- End of 5.0 tests # ------------------------------------------------------------------
mysql-test/t/sp-error.test +8 −0 Original line number Diff line number Diff line Loading @@ -2173,6 +2173,14 @@ begin end loop; end| CREATE TABLE t1 (a INT)| INSERT INTO t1 VALUES (1),(2)| CREATE PROCEDURE p1(a INT) BEGIN END| --error ER_SUBQUERY_NO_1_ROW CALL p1((SELECT * FROM t1))| DROP PROCEDURE IF EXISTS p1| DROP TABLE t1| delimiter ;| # Loading
mysql-test/t/sp.test +18 −0 Original line number Diff line number Diff line Loading @@ -7818,6 +7818,24 @@ drop function f1; drop view v1; drop table t1; # # Bug#38469 invalid memory read and/or crash with utf8 text field, stored procedure, uservar # delimiter $; --disable_warnings drop procedure if exists `p2` $ --enable_warnings create procedure `p2`(in `a` text charset utf8) begin declare `pos` int default 1; declare `str` text charset utf8; set `str` := `a`; select substr(`str`, `pos`+ 1 ) into `str`; end $ delimiter ;$ call `p2`('s s s s s s'); drop procedure `p2`; --echo # ------------------------------------------------------------------ --echo # -- End of 5.0 tests --echo # ------------------------------------------------------------------
sql/field.cc +11 −1 Original line number Diff line number Diff line Loading @@ -6992,8 +6992,18 @@ int Field_blob::store(const char *from,uint length,CHARSET_INFO *cs) return 0; } if (from == value.ptr()) /* If the 'from' address is in the range of the temporary 'value'- object we need to copy the content to a different location or it will be invalidated when the 'value'-object is reallocated to make room for the new character set. */ if (from >= value.ptr() && from <= value.ptr()+value.length()) { /* If content of the 'from'-address is cached in the 'value'-object it is possible that the content needs a character conversion. */ uint32 dummy_offset; if (!String::needs_conversion(length, cs, field_charset, &dummy_offset)) { Loading