summaryrefslogtreecommitdiff
path: root/mysql-test
diff options
context:
space:
mode:
authorAlexander Barkov <bar@mariadb.com>2022-11-17 17:51:01 +0400
committerAlexander Barkov <bar@mariadb.com>2022-11-17 17:51:01 +0400
commit6216a2dfa2faabf8abfd3099a6cd46b00cef4115 (patch)
tree219818f8934e80d7c7f531bc9391ce3a902a32fe /mysql-test
parentdf4c3d96a4aba0e5a9af3bd5158cd2049a978130 (diff)
downloadmariadb-git-6216a2dfa2faabf8abfd3099a6cd46b00cef4115.tar.gz
MDEV-29473 UBSAN: Signed integer overflow: X * Y cannot be represented in type 'int' in strings/dtoa.c
Fixing a few problems relealed by UBSAN in type_float.test - multiplication overflow in dtoa.c - uninitialized Field::geom_type (and Field::srid as well) - Wrong call-back function types used in combination with SHOW_FUNC. Changes in the mysql_show_var_func data type definition were not properly addressed all around the code by the following commits: b4ff64568c88ab3ce559e7bd39853d9cbf86704a 18feb62feeb833494d003615861b9c78ec008a90 0ee879ff8ac1b80cd9a963015344f5698a81f309 Adding a helper SHOW_FUNC_ENTRY() function and replacing all mysql_show_var_func declarations using SHOW_FUNC to SHOW_FUNC_ENTRY, to catch mysql_show_var_func in the future at compilation time.
Diffstat (limited to 'mysql-test')
-rw-r--r--mysql-test/main/type_float.result7
-rw-r--r--mysql-test/main/type_float.test10
2 files changed, 17 insertions, 0 deletions
diff --git a/mysql-test/main/type_float.result b/mysql-test/main/type_float.result
index a5f70d9ef80..5354fa50e19 100644
--- a/mysql-test/main/type_float.result
+++ b/mysql-test/main/type_float.result
@@ -964,5 +964,12 @@ id a
DELETE FROM t1 WHERE a=CAST(0.671437 AS FLOAT);
DROP TABLE t1;
#
+# MDEV-29473 UBSAN: Signed integer overflow: X * Y cannot be represented in type 'int' in strings/dtoa.c
+#
+CREATE TABLE t1 (c DOUBLE);
+INSERT INTO t1 VALUES ('1e4294967297');
+ERROR 22003: Out of range value for column 'c' at row 1
+DROP TABLE t1;
+#
# End of 10.3 tests
#
diff --git a/mysql-test/main/type_float.test b/mysql-test/main/type_float.test
index 5d7f7de7d0b..3f9781e6224 100644
--- a/mysql-test/main/type_float.test
+++ b/mysql-test/main/type_float.test
@@ -670,6 +670,16 @@ SELECT * FROM t1;
DELETE FROM t1 WHERE a=CAST(0.671437 AS FLOAT);
DROP TABLE t1;
+--echo #
+--echo # MDEV-29473 UBSAN: Signed integer overflow: X * Y cannot be represented in type 'int' in strings/dtoa.c
+--echo #
+
+# This test was failing with UBSAN builds
+
+CREATE TABLE t1 (c DOUBLE);
+--error ER_WARN_DATA_OUT_OF_RANGE
+INSERT INTO t1 VALUES ('1e4294967297');
+DROP TABLE t1;
--echo #
--echo # End of 10.3 tests