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:
    b4ff64568c
    18feb62fee
    0ee879ff8a

  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.
This commit is contained in:
Alexander Barkov 2022-11-17 17:51:01 +04:00
commit 6216a2dfa2
17 changed files with 128 additions and 29 deletions

View file

@ -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
#

View file

@ -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