diff options
author | unknown <cmiller@zippy.cornsilk.net> | 2006-09-27 19:26:25 -0400 |
---|---|---|
committer | unknown <cmiller@zippy.cornsilk.net> | 2006-09-27 19:26:25 -0400 |
commit | 033db2d038a05a61eabeba40a581720b0845da39 (patch) | |
tree | fb19a9f7e7539101573fd272b7d1ec95398d431e /mysql-test/r | |
parent | 131d94f58c07629ec37c0af32c6657dea8bc5e4e (diff) | |
download | mariadb-git-033db2d038a05a61eabeba40a581720b0845da39.tar.gz |
Bug #20778: strange characters in warning message 1366 when called in SP
The function receives an exactly-sized buffer (not a C NUL-terminated string)
and passes it into a printf function to be interpreted with "%s".
Instead, create an intermediate String object, and copy the data into it,
and pass in a pointer to the String's NUL-terminated buffer.
mysql-test/r/warnings.result:
Test that warnings do not read outside its intended memory space.
mysql-test/t/warnings.test:
Test that warnings do not read outside its intended memory space.
sql/field.cc:
Create a new String object and use a pointer to its data instead of the
exactly-sized buffer to be interpreted as a C string deep within the
errmsg.txt list via printf.
Diffstat (limited to 'mysql-test/r')
-rw-r--r-- | mysql-test/r/warnings.result | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/mysql-test/r/warnings.result b/mysql-test/r/warnings.result index 283a0661721..f01ffc1d7d4 100644 --- a/mysql-test/r/warnings.result +++ b/mysql-test/r/warnings.result @@ -243,3 +243,59 @@ a select * from t1 limit 0, 0; a drop table t1; +End of 4.1 tests +CREATE TABLE t1( f1 CHAR(20) ); +CREATE TABLE t2( f1 CHAR(20), f2 CHAR(25) ); +CREATE TABLE t3( f1 CHAR(20), f2 CHAR(25), f3 DATE ); +INSERT INTO t1 VALUES ( 'a`' ); +INSERT INTO t2 VALUES ( 'a`', 'a`' ); +INSERT INTO t3 VALUES ( 'a`', 'a`', '1000-01-1' ); +DROP PROCEDURE IF EXISTS sp1; +Warnings: +Note 1305 PROCEDURE sp1 does not exist +DROP PROCEDURE IF EXISTS sp2; +Warnings: +Note 1305 PROCEDURE sp2 does not exist +DROP PROCEDURE IF EXISTS sp3; +Warnings: +Note 1305 PROCEDURE sp3 does not exist +CREATE PROCEDURE sp1() +BEGIN +DECLARE x NUMERIC ZEROFILL; +SELECT f1 INTO x FROM t1 LIMIT 1; +END// +CREATE PROCEDURE sp2() +BEGIN +DECLARE x NUMERIC ZEROFILL; +SELECT f1 INTO x FROM t2 LIMIT 1; +END// +CREATE PROCEDURE sp3() +BEGIN +DECLARE x NUMERIC ZEROFILL; +SELECT f1 INTO x FROM t3 LIMIT 1; +END// +CALL sp1(); +Warnings: +Warning 1366 Incorrect decimal value: 'a`' for column 'x' at row 1 +CALL sp2(); +Warnings: +Warning 1366 Incorrect decimal value: 'a`' for column 'x' at row 1 +CALL sp3(); +Warnings: +Warning 1366 Incorrect decimal value: 'a`' for column 'x' at row 1 +DROP PROCEDURE IF EXISTS sp1; +CREATE PROCEDURE sp1() +BEGIN +declare x numeric unsigned zerofill; +SELECT f1 into x from t2 limit 1; +END// +CALL sp1(); +Warnings: +Warning 1366 Incorrect decimal value: 'a`' for column 'x' at row 1 +DROP TABLE t1; +DROP TABLE t2; +DROP TABLE t3; +DROP PROCEDURE sp1; +DROP PROCEDURE sp2; +DROP PROCEDURE sp3; +End of 5.0 tests |