summaryrefslogtreecommitdiff
path: root/mysql-test/main/func_math.test
diff options
context:
space:
mode:
authorAlexander Barkov <bar@mariadb.com>2020-06-13 09:30:04 +0400
committerAlexander Barkov <bar@mariadb.com>2020-06-13 09:30:04 +0400
commit6c30bc2181328ea619d1ab61a464feb0514bf12a (patch)
treec5a1bc61de369ed5e5df9fb441fb2aa7ea2e5292 /mysql-test/main/func_math.test
parent81a08c5462154e169d0a35e52c023d066065b175 (diff)
downloadmariadb-git-6c30bc2181328ea619d1ab61a464feb0514bf12a.tar.gz
MDEV-22268 virtual longlong Item_func_div::int_op(): Assertion `0' failed in Item_func_div::int_op
Item_func_div::fix_length_and_dec_temporal() set the return data type to integer in case of @div_precision_increment==0 for temporal input with FSP=0. This caused Item_func_div to call int_op(), which is not implemented, so a crash on DBUG_ASSERT(0) happened. Fixing fix_length_and_dec_temporal() to set the result type to DECIMAL.
Diffstat (limited to 'mysql-test/main/func_math.test')
-rw-r--r--mysql-test/main/func_math.test23
1 files changed, 23 insertions, 0 deletions
diff --git a/mysql-test/main/func_math.test b/mysql-test/main/func_math.test
index 7bd0b0e5a4f..f169ae0c326 100644
--- a/mysql-test/main/func_math.test
+++ b/mysql-test/main/func_math.test
@@ -1111,6 +1111,29 @@ CREATE TABLE t1 (i INT(23));
SELECT ROUND( i, 18446744073709551594 ) AS f FROM t1;
DROP TABLE t1;
+
+--echo #
+--echo # MDEV-22268 virtual longlong Item_func_div::int_op(): Assertion `0' failed in Item_func_div::int_op
+--echo #
+
+SET sql_mode='';
+SET @@SESSION.div_precision_increment=0;
+SELECT UTC_TIME / 0;
+SELECT TIMESTAMP'2001-01-01 00:00:00'/0;
+SELECT TIME'00:00:00'/0;
+CREATE TABLE t1 AS SELECT
+ UTC_TIME / 0 AS c1,
+ TIMESTAMP'2001-01-01 00:00:00'/0 AS c3,
+ TIME'00:00:00'/0 AS c4;
+SHOW CREATE TABLE t1;
+DROP TABLE t1;
+
+--error ER_DATA_OUT_OF_RANGE
+SELECT(-0 * MOD((UTC_TIME / -0)MOD (ATAN('<img src_x0=x onerror="javascript:alert(0)">') MOD COT(0)),-0)) MOD (0 DIV 0);
+
+SET @@SESSION.div_precision_increment=DEFAULT;
+SET sql_mode=DEFAULT;
+
--echo #
--echo # End of 10.3 tests
--echo #