From 6216a2dfa2faabf8abfd3099a6cd46b00cef4115 Mon Sep 17 00:00:00 2001 From: Alexander Barkov Date: Thu, 17 Nov 2022 17:51:01 +0400 Subject: 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. --- plugin/handler_socket/handlersocket/handlersocket.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'plugin') diff --git a/plugin/handler_socket/handlersocket/handlersocket.cpp b/plugin/handler_socket/handlersocket/handlersocket.cpp index 8133497044c..45c9e13b2ca 100644 --- a/plugin/handler_socket/handlersocket/handlersocket.cpp +++ b/plugin/handler_socket/handlersocket/handlersocket.cpp @@ -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} }; -- cgit v1.2.1