mirror of
https://github.com/MariaDB/server.git
synced 2025-08-08 11:22:35 +03:00
MDEV-30727 Check spider_hton_ptr in spider udfs
UDF isn't supposed to use my_error(), it should return
the error message in the provided error message buffer
Fixes valgrind:
==93993== Conditional jump or move depends on uninitialised value(s)
==93993== at 0x484ECCD: strnlen (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so)
==93993== by 0x1AD2B2C: process_str_arg (my_vsnprintf.c:259)
==93993== by 0x1AD47E0: my_vsnprintf_ex (my_vsnprintf.c:696)
==93993== by 0x1A3B91E: my_error (my_error.c:120)
==93993== by 0xF87BE8: udf_handler::fix_fields(THD*, Item_func_or_sum*, unsigned int, Item**) (item_func.cc:3638)
followup for 267dd5a993
This commit is contained in:
@@ -1,12 +1,12 @@
|
|||||||
CREATE FUNCTION spider_direct_sql RETURNS INT SONAME 'ha_spider.so';
|
CREATE FUNCTION spider_direct_sql RETURNS INT SONAME 'ha_spider.so';
|
||||||
SELECT spider_direct_sql ('SELECT * FROM s','a','srv "b"');
|
SELECT spider_direct_sql ('SELECT * FROM s','a','srv "b"');
|
||||||
ERROR HY000: Plugin 'SPIDER' is not loaded
|
ERROR HY000: Can't initialize function 'spider_direct_sql'; Plugin 'SPIDER' is not loaded
|
||||||
CREATE FUNCTION spider_bg_direct_sql RETURNS INT SONAME 'ha_spider.so';
|
CREATE FUNCTION spider_bg_direct_sql RETURNS INT SONAME 'ha_spider.so';
|
||||||
SELECT spider_bg_direct_sql ('SELECT * FROM s','a','srv "b"');
|
SELECT spider_bg_direct_sql ('SELECT * FROM s','a','srv "b"');
|
||||||
ERROR HY000: Plugin 'SPIDER' is not loaded
|
ERROR HY000: Can't initialize function 'spider_bg_direct_sql'; Plugin 'SPIDER' is not loaded
|
||||||
CREATE FUNCTION spider_copy_tables RETURNS INT SONAME 'ha_spider.so';
|
CREATE FUNCTION spider_copy_tables RETURNS INT SONAME 'ha_spider.so';
|
||||||
SELECT spider_copy_tables ('t', '0', '0');
|
SELECT spider_copy_tables ('t', '0', '0');
|
||||||
ERROR HY000: Plugin 'SPIDER' is not loaded
|
ERROR HY000: Can't initialize function 'spider_copy_tables'; Plugin 'SPIDER' is not loaded
|
||||||
CREATE FUNCTION spider_flush_table_mon_cache RETURNS INT SONAME 'ha_spider.so';
|
CREATE FUNCTION spider_flush_table_mon_cache RETURNS INT SONAME 'ha_spider.so';
|
||||||
SELECT spider_flush_table_mon_cache ();
|
SELECT spider_flush_table_mon_cache ();
|
||||||
spider_flush_table_mon_cache ()
|
spider_flush_table_mon_cache ()
|
||||||
|
@@ -1,13 +1,13 @@
|
|||||||
CREATE FUNCTION spider_direct_sql RETURNS INT SONAME 'ha_spider.so';
|
CREATE FUNCTION spider_direct_sql RETURNS INT SONAME 'ha_spider.so';
|
||||||
--error ER_PLUGIN_IS_NOT_LOADED
|
--error ER_CANT_INITIALIZE_UDF
|
||||||
SELECT spider_direct_sql ('SELECT * FROM s','a','srv "b"');
|
SELECT spider_direct_sql ('SELECT * FROM s','a','srv "b"');
|
||||||
|
|
||||||
CREATE FUNCTION spider_bg_direct_sql RETURNS INT SONAME 'ha_spider.so';
|
CREATE FUNCTION spider_bg_direct_sql RETURNS INT SONAME 'ha_spider.so';
|
||||||
--error ER_PLUGIN_IS_NOT_LOADED
|
--error ER_CANT_INITIALIZE_UDF
|
||||||
SELECT spider_bg_direct_sql ('SELECT * FROM s','a','srv "b"');
|
SELECT spider_bg_direct_sql ('SELECT * FROM s','a','srv "b"');
|
||||||
|
|
||||||
CREATE FUNCTION spider_copy_tables RETURNS INT SONAME 'ha_spider.so';
|
CREATE FUNCTION spider_copy_tables RETURNS INT SONAME 'ha_spider.so';
|
||||||
--error ER_PLUGIN_IS_NOT_LOADED
|
--error ER_CANT_INITIALIZE_UDF
|
||||||
SELECT spider_copy_tables ('t', '0', '0');
|
SELECT spider_copy_tables ('t', '0', '0');
|
||||||
|
|
||||||
# spider_flush_table_mon_cache does not require spider init to function
|
# spider_flush_table_mon_cache does not require spider init to function
|
||||||
|
@@ -1154,9 +1154,6 @@ error:
|
|||||||
DBUG_RETURN(0);
|
DBUG_RETURN(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
#undef my_error
|
|
||||||
extern "C" void my_error(unsigned int nr, unsigned long MyFlags, ...);
|
|
||||||
|
|
||||||
my_bool spider_copy_tables_init_body(
|
my_bool spider_copy_tables_init_body(
|
||||||
UDF_INIT *initid,
|
UDF_INIT *initid,
|
||||||
UDF_ARGS *args,
|
UDF_ARGS *args,
|
||||||
@@ -1165,7 +1162,7 @@ my_bool spider_copy_tables_init_body(
|
|||||||
DBUG_ENTER("spider_copy_tables_init_body");
|
DBUG_ENTER("spider_copy_tables_init_body");
|
||||||
if (!spider_hton_ptr)
|
if (!spider_hton_ptr)
|
||||||
{
|
{
|
||||||
my_error(ER_PLUGIN_IS_NOT_LOADED, MYF(0), "SPIDER");
|
strcpy(message, "Plugin 'SPIDER' is not loaded");
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
if (args->arg_count != 3 && args->arg_count != 4)
|
if (args->arg_count != 3 && args->arg_count != 4)
|
||||||
|
@@ -1789,9 +1789,6 @@ error:
|
|||||||
DBUG_RETURN(0);
|
DBUG_RETURN(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
#undef my_error
|
|
||||||
extern "C" void my_error(unsigned int nr, unsigned long MyFlags, ...);
|
|
||||||
|
|
||||||
my_bool spider_direct_sql_init_body(
|
my_bool spider_direct_sql_init_body(
|
||||||
UDF_INIT *initid,
|
UDF_INIT *initid,
|
||||||
UDF_ARGS *args,
|
UDF_ARGS *args,
|
||||||
@@ -1802,7 +1799,7 @@ my_bool spider_direct_sql_init_body(
|
|||||||
DBUG_ENTER("spider_direct_sql_init_body");
|
DBUG_ENTER("spider_direct_sql_init_body");
|
||||||
if (!spider_hton_ptr)
|
if (!spider_hton_ptr)
|
||||||
{
|
{
|
||||||
my_error(ER_PLUGIN_IS_NOT_LOADED, MYF(0), "SPIDER");
|
strcpy(message, "Plugin 'SPIDER' is not loaded");
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
if (args->arg_count != 3)
|
if (args->arg_count != 3)
|
||||||
|
Reference in New Issue
Block a user