1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-29 05:21:33 +03:00

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
parent df4c3d96a4
commit 6216a2dfa2
17 changed files with 128 additions and 29 deletions

View File

@ -185,7 +185,9 @@ static SHOW_VAR hs_status_variables[] = {
{NullS, NullS, SHOW_LONG}
};
static int show_hs_vars(THD *thd, SHOW_VAR *var, char *buff)
static int show_hs_vars(THD *thd, SHOW_VAR *var, void *buff,
struct system_status_var *status_var,
enum enum_var_type var_type)
{
var->type= SHOW_ARRAY;
var->value= (char *) &hs_status_variables;
@ -193,7 +195,7 @@ static int show_hs_vars(THD *thd, SHOW_VAR *var, char *buff)
}
static SHOW_VAR daemon_handlersocket_status_variables[] = {
{"Hs", (char*) show_hs_vars, SHOW_FUNC},
SHOW_FUNC_ENTRY("Hs", &show_hs_vars),
{NullS, NullS, SHOW_LONG}
};