summaryrefslogtreecommitdiff
path: root/mysql-test/t/func_math.test
diff options
context:
space:
mode:
authorTor Didriksen <tor.didriksen@oracle.com>2011-01-14 10:05:14 +0100
committerTor Didriksen <tor.didriksen@oracle.com>2011-01-14 10:05:14 +0100
commit7bf234032a6debc28f24fbbffe7e3cacb7b1803b (patch)
treea6039675e5fcc73cb3cde80664b6c2e4f1f83294 /mysql-test/t/func_math.test
parentff2b529918c2c12d4a29f8f34c5d9afbf5e40464 (diff)
downloadmariadb-git-7bf234032a6debc28f24fbbffe7e3cacb7b1803b.tar.gz
Bug #59241 invalid memory read in do_div_mod with doubly assigned variables
Fix: copy my_decimal by value, to avoid dangling pointers. mysql-test/r/func_math.result: New test case. mysql-test/t/func_math.test: New test case. sql/item_cmpfunc.cc: No need to call fix_buffer_pointer() anymore. sql/item_func.cc: Copy my_decimal by value, to avoid dangling pointers. sql/my_decimal.h: Implement proper copy constructor and assignment operator for my_decimal. sql/sql_analyse.cc: No need to call fix_buffer_pointer() anymore. strings/decimal.c: Remove #line directive: it messes up TAGS and it confuses gdb when debugging.
Diffstat (limited to 'mysql-test/t/func_math.test')
-rw-r--r--mysql-test/t/func_math.test6
1 files changed, 6 insertions, 0 deletions
diff --git a/mysql-test/t/func_math.test b/mysql-test/t/func_math.test
index b089d10a33b..fe253617a27 100644
--- a/mysql-test/t/func_math.test
+++ b/mysql-test/t/func_math.test
@@ -489,3 +489,9 @@ as foo;
CREATE TABLE t1(a char(0));
INSERT INTO t1 (SELECT -pi());
DROP TABLE t1;
+
+--echo #
+--echo # Bug #59241 invalid memory read
+--echo # in do_div_mod with doubly assigned variables
+--echo #
+SELECT ((@a:=@b:=1.0) div (@b:=@a:=get_format(datetime, 'usa')));