diff options
author | Alexander Barkov <bar@mariadb.com> | 2022-11-17 17:51:01 +0400 |
---|---|---|
committer | Alexander Barkov <bar@mariadb.com> | 2022-11-17 17:51:01 +0400 |
commit | 6216a2dfa2faabf8abfd3099a6cd46b00cef4115 (patch) | |
tree | 219818f8934e80d7c7f531bc9391ce3a902a32fe /include/mysql | |
parent | df4c3d96a4aba0e5a9af3bd5158cd2049a978130 (diff) | |
download | mariadb-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 'include/mysql')
-rw-r--r-- | include/mysql/plugin.h | 12 | ||||
-rw-r--r-- | include/mysql/plugin_audit.h.pp | 10 | ||||
-rw-r--r-- | include/mysql/plugin_auth.h.pp | 10 | ||||
-rw-r--r-- | include/mysql/plugin_encryption.h.pp | 10 | ||||
-rw-r--r-- | include/mysql/plugin_ftparser.h.pp | 10 | ||||
-rw-r--r-- | include/mysql/plugin_password_validation.h.pp | 10 |
6 files changed, 62 insertions, 0 deletions
diff --git a/include/mysql/plugin.h b/include/mysql/plugin.h index 360f633b7dd..b15f42fe6c7 100644 --- a/include/mysql/plugin.h +++ b/include/mysql/plugin.h @@ -200,6 +200,18 @@ struct system_status_var; typedef int (*mysql_show_var_func)(MYSQL_THD, struct st_mysql_show_var*, void *, struct system_status_var *status_var, enum enum_var_type); +static inline +struct st_mysql_show_var SHOW_FUNC_ENTRY(const char *name, + mysql_show_var_func func_arg) +{ + struct st_mysql_show_var tmp; + tmp.name= name; + tmp.value= (void*) func_arg; + tmp.type= SHOW_FUNC; + return tmp; +}; + + /* Constants for plugin flags. */ diff --git a/include/mysql/plugin_audit.h.pp b/include/mysql/plugin_audit.h.pp index 89f7dcc36c4..b8cafee28ec 100644 --- a/include/mysql/plugin_audit.h.pp +++ b/include/mysql/plugin_audit.h.pp @@ -400,6 +400,16 @@ struct st_mysql_show_var { }; struct system_status_var; typedef int (*mysql_show_var_func)(void*, struct st_mysql_show_var*, void *, struct system_status_var *status_var, enum enum_var_type); +static inline +struct st_mysql_show_var SHOW_FUNC_ENTRY(const char *name, + mysql_show_var_func func_arg) +{ + struct st_mysql_show_var tmp; + tmp.name= name; + tmp.value= (void*) func_arg; + tmp.type= SHOW_FUNC; + return tmp; +}; struct st_mysql_sys_var; struct st_mysql_value; typedef int (*mysql_var_check_func)(void* thd, diff --git a/include/mysql/plugin_auth.h.pp b/include/mysql/plugin_auth.h.pp index e515699cad6..68e2bcb9956 100644 --- a/include/mysql/plugin_auth.h.pp +++ b/include/mysql/plugin_auth.h.pp @@ -400,6 +400,16 @@ struct st_mysql_show_var { }; struct system_status_var; typedef int (*mysql_show_var_func)(void*, struct st_mysql_show_var*, void *, struct system_status_var *status_var, enum enum_var_type); +static inline +struct st_mysql_show_var SHOW_FUNC_ENTRY(const char *name, + mysql_show_var_func func_arg) +{ + struct st_mysql_show_var tmp; + tmp.name= name; + tmp.value= (void*) func_arg; + tmp.type= SHOW_FUNC; + return tmp; +}; struct st_mysql_sys_var; struct st_mysql_value; typedef int (*mysql_var_check_func)(void* thd, diff --git a/include/mysql/plugin_encryption.h.pp b/include/mysql/plugin_encryption.h.pp index 7defe0aec2c..838d0e49ed5 100644 --- a/include/mysql/plugin_encryption.h.pp +++ b/include/mysql/plugin_encryption.h.pp @@ -400,6 +400,16 @@ struct st_mysql_show_var { }; struct system_status_var; typedef int (*mysql_show_var_func)(void*, struct st_mysql_show_var*, void *, struct system_status_var *status_var, enum enum_var_type); +static inline +struct st_mysql_show_var SHOW_FUNC_ENTRY(const char *name, + mysql_show_var_func func_arg) +{ + struct st_mysql_show_var tmp; + tmp.name= name; + tmp.value= (void*) func_arg; + tmp.type= SHOW_FUNC; + return tmp; +}; struct st_mysql_sys_var; struct st_mysql_value; typedef int (*mysql_var_check_func)(void* thd, diff --git a/include/mysql/plugin_ftparser.h.pp b/include/mysql/plugin_ftparser.h.pp index a36f51e74e1..3c28bd3b2e0 100644 --- a/include/mysql/plugin_ftparser.h.pp +++ b/include/mysql/plugin_ftparser.h.pp @@ -400,6 +400,16 @@ struct st_mysql_show_var { }; struct system_status_var; typedef int (*mysql_show_var_func)(void*, struct st_mysql_show_var*, void *, struct system_status_var *status_var, enum enum_var_type); +static inline +struct st_mysql_show_var SHOW_FUNC_ENTRY(const char *name, + mysql_show_var_func func_arg) +{ + struct st_mysql_show_var tmp; + tmp.name= name; + tmp.value= (void*) func_arg; + tmp.type= SHOW_FUNC; + return tmp; +}; struct st_mysql_sys_var; struct st_mysql_value; typedef int (*mysql_var_check_func)(void* thd, diff --git a/include/mysql/plugin_password_validation.h.pp b/include/mysql/plugin_password_validation.h.pp index 9701ad1b92f..bf05ca36351 100644 --- a/include/mysql/plugin_password_validation.h.pp +++ b/include/mysql/plugin_password_validation.h.pp @@ -400,6 +400,16 @@ struct st_mysql_show_var { }; struct system_status_var; typedef int (*mysql_show_var_func)(void*, struct st_mysql_show_var*, void *, struct system_status_var *status_var, enum enum_var_type); +static inline +struct st_mysql_show_var SHOW_FUNC_ENTRY(const char *name, + mysql_show_var_func func_arg) +{ + struct st_mysql_show_var tmp; + tmp.name= name; + tmp.value= (void*) func_arg; + tmp.type= SHOW_FUNC; + return tmp; +}; struct st_mysql_sys_var; struct st_mysql_value; typedef int (*mysql_var_check_func)(void* thd, |