Skip to content

Commit

Permalink
MDEV-35735: UBSAN: spider udf functions mismatch with UDF defination
Browse files Browse the repository at this point in the history
The mismatch occurs on the function calls as in the sql/sql_udf.h the
types of "error" and "is_null" are unsigned char rather than char.

This is corrected for the udf functions:
* spider_direct_sql
* spider_direct_bg_sql
* spider_flush_table_mon_cache
* spider_copy_tables
* spider_ping_table

Reviewer: Yuchen Pei
  • Loading branch information
grooverdan committed Jan 12, 2025
1 parent f077bb4 commit 645e2a0
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 26 deletions.
4 changes: 2 additions & 2 deletions storage/spider/spd_copy_tables.cc
Original file line number Diff line number Diff line change
Expand Up @@ -714,8 +714,8 @@ int spider_udf_bg_copy_exec_sql(
long long spider_copy_tables_body(
UDF_INIT *initid,
UDF_ARGS *args,
char *is_null,
char *error
unsigned char *is_null,
unsigned char *error
) {
int error_num, roop_count, all_link_cnt = 0, use_table_charset;
SPIDER_COPY_TABLES *copy_tables = NULL;
Expand Down
4 changes: 2 additions & 2 deletions storage/spider/spd_direct_sql.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1225,8 +1225,8 @@ void spider_udf_free_direct_sql_alloc(
long long spider_direct_sql_body(
UDF_INIT *initid,
UDF_ARGS *args,
char *is_null,
char *error,
unsigned char *is_null,
unsigned char *error,
my_bool bg
) {
int error_num, roop_count;
Expand Down
4 changes: 2 additions & 2 deletions storage/spider/spd_ping_table.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1071,8 +1071,8 @@ int spider_ping_table_cache_compare(
long long spider_ping_table_body(
UDF_INIT *initid,
UDF_ARGS *args,
char *is_null,
char *error
unsigned char *is_null,
unsigned char *error
) {
int error_num = 0, link_idx, flags, full_mon_count, current_mon_count,
success_count, fault_count, tmp_error_num = 0;
Expand Down
28 changes: 14 additions & 14 deletions storage/spider/spd_udf.cc
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ extern "C" {
long long spider_direct_sql(
UDF_INIT *initid,
UDF_ARGS *args,
char *is_null,
char *error
unsigned char *is_null,
unsigned char *error
) {
return spider_direct_sql_body(initid, args, is_null, error, FALSE);
}
Expand All @@ -46,8 +46,8 @@ void spider_direct_sql_deinit(
long long spider_bg_direct_sql(
UDF_INIT *initid,
UDF_ARGS *args,
char *is_null,
char *error
unsigned char *is_null,
unsigned char *error
) {
return spider_direct_sql_bg_end(initid);
}
Expand All @@ -68,17 +68,17 @@ void spider_bg_direct_sql_deinit(

void spider_bg_direct_sql_clear(
UDF_INIT *initid,
char *is_null,
char *error
unsigned char *is_null,
unsigned char *error
) {
spider_direct_sql_bg_start(initid);
}

void spider_bg_direct_sql_add(
UDF_INIT *initid,
UDF_ARGS *args,
char *is_null,
char *error
unsigned char *is_null,
unsigned char *error
) {
spider_direct_sql_body(initid, args, is_null, error, TRUE);
}
Expand All @@ -87,8 +87,8 @@ void spider_bg_direct_sql_add(
long long spider_ping_table(
UDF_INIT *initid,
UDF_ARGS *args,
char *is_null,
char *error
unsigned char *is_null,
unsigned char *error
) {
return spider_ping_table_body(initid, args, is_null, error);
}
Expand All @@ -110,8 +110,8 @@ void spider_ping_table_deinit(
long long spider_flush_table_mon_cache(
UDF_INIT *initid,
UDF_ARGS *args,
char *is_null,
char *error
unsigned char *is_null,
unsigned char *error
) {
return spider_flush_table_mon_cache_body();
}
Expand All @@ -132,8 +132,8 @@ void spider_flush_table_mon_cache_deinit(
long long spider_copy_tables(
UDF_INIT *initid,
UDF_ARGS *args,
char *is_null,
char *error
unsigned char *is_null,
unsigned char *error
) {
return spider_copy_tables_body(initid, args, is_null, error);
}
Expand Down
12 changes: 6 additions & 6 deletions storage/spider/spd_udf.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
long long spider_direct_sql_body(
UDF_INIT *initid,
UDF_ARGS *args,
char *is_null,
char *error,
unsigned char *is_null,
unsigned char *error,
my_bool bg
);

Expand Down Expand Up @@ -45,8 +45,8 @@ long long spider_direct_sql_bg_end(
long long spider_ping_table_body(
UDF_INIT *initid,
UDF_ARGS *args,
char *is_null,
char *error
unsigned char *is_null,
unsigned char *error
);

my_bool spider_ping_table_init_body(
Expand All @@ -64,8 +64,8 @@ long long spider_flush_table_mon_cache_body();
long long spider_copy_tables_body(
UDF_INIT *initid,
UDF_ARGS *args,
char *is_null,
char *error
unsigned char *is_null,
unsigned char *error
);

my_bool spider_copy_tables_init_body(
Expand Down

0 comments on commit 645e2a0

Please sign in to comment.