diff options
author | Kristofer Pettersson <kpettersson@mysql.com> | 2008-09-20 10:51:03 +0200 |
---|---|---|
committer | Kristofer Pettersson <kpettersson@mysql.com> | 2008-09-20 10:51:03 +0200 |
commit | f0352e346a1a7dbf056ac87239ed9b407d70886b (patch) | |
tree | cab4087b617d73f6e364a0e4112bb80ede44a1c7 /mysql-test/t/sp.test | |
parent | bed8cec4854c3a4447961f389a2ff602374c9107 (diff) | |
download | mariadb-git-f0352e346a1a7dbf056ac87239ed9b407d70886b.tar.gz |
Bug#38469 invalid memory read and/or crash with utf8 text field, stored procedure, uservar
A stored procedure involving substrings could crash the server on certain
platforms because of invalid memory reads.
During storing the new blob-field value, the cached value's address range
overlapped that of the new field value. This caused problems when the
cached value storage was reallocated to provide access for a new
characater set representation. The patch checks the address ranges, and if
they overlap, the new field value is copied to a new storage before it is
converted to the new character set.
mysql-test/r/sp.result:
Added result set
mysql-test/t/sp.test:
Added test case
sql/field.cc:
The source and destination address ranges of a character conversion must not overlap or the 'from' address will be invalidated as the temporary value-
object is re-allocated to fit the new character set.
sql/field.h:
Added comments
Diffstat (limited to 'mysql-test/t/sp.test')
-rw-r--r-- | mysql-test/t/sp.test | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/mysql-test/t/sp.test b/mysql-test/t/sp.test index 87ab1d2f0d9..21ca2528e4f 100644 --- a/mysql-test/t/sp.test +++ b/mysql-test/t/sp.test @@ -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 # ------------------------------------------------------------------ |