Bug #3934 UDF on Windows crash the server
Description:
I created an VC++ project for to be added to the examples
package release and the functions: sequence() and avgcost()
crash the server disregarding the arguments how you can see
below:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 1 to server version: 4.0.20a-debug
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
mysql> CREATE FUNCTION metaphon RETURNS STRING SONAME "myudf.dll";
Query OK, 0 rows affected (0.25 sec)
mysql> select metaphon("my test");
+---------------------+
| metaphon("my test") |
+---------------------+
| MTST |
+---------------------+
1 row in set (0.12 sec)
mysql> CREATE FUNCTION myfunc_double RETURNS REAL SONAME "myudf.dll";
Query OK, 0 rows affected (0.00 sec)
mysql> select myfunc_double("my test");
+--------------------------+
| myfunc_double("my test") |
+--------------------------+
| 101.42857142857 |
+--------------------------+
1 row in set (0.00 sec)
mysql> CREATE FUNCTION myfunc_int RETURNS INTEGER SONAME "myudf.dll";
Query OK, 0 rows affected (0.00 sec)
mysql> select myfunc_int("my test");
+-----------------------+
| myfunc_int("my test") |
+-----------------------+
| 7 |
+-----------------------+
1 row in set (0.00 sec)
mysql> CREATE FUNCTION sequence RETURNS INTEGER SONAME "myudf.dll";
Query OK, 0 rows affected (0.01 sec)
mysql> select sequence(1);
ERROR 2013: Lost connection to MySQL server during query
mysql> select sequence("mytest");
ERROR 2013: Lost connection to MySQL server during query
CALL STACK
myudf.dll!10001541()
mysqld.exe!Item_func_udf_int::val_int() Line 1407 C++
mysqld.exe!Item_func_udf_int::val_str(String * str=0x03a7f1f8)
Line 1412 + 0xb C++
mysqld.exe!Item::send(THD * thd=0x02554948, String * packet=0x02554e18)
Line 675 + 0x15 C++
mysqld.exe!select_send::send_data(List<Item> & items={...})
Line 490 + 0x16 C++
mysqld.exe!mysql_select(THD * thd=0x02554948, st_table_list
* tables=0x00000000, List<Item> & fields={...},
Item * conds=0x00000000, st_order * order=0x00000000, st_order
* group=0x00000000, Item * having=0x00000000, st_order
* proc_param=0x00000000, unsigned long select_options=17339392,
select_result * result=0x0255d9d8) Line 445 + 0x18 C++
mysqld.exe!handle_select(THD * thd=0x02554948, st_lex * lex=0x02554a78,
select_result * result=0x0255d9d8) Line 191 + 0x51 C++
mysqld.exe!mysql_execute_command() Line 1457 + 0x11 C++
mysqld.exe!mysql_parse(THD * thd=0x02554948, char * inBuf=0x0255d8b0,
unsigned int length=25) Line 3001 C++
mysqld.exe!dispatch_command(enum_server_command command=COM_QUERY,
THD * thd=0x02554948, char * packet=0x02559849,
unsigned int packet_length=25) Line 1083 + 0x17 C++
mysqld.exe!do_command(THD * thd=0x02554948) Line 953 + 0x31 C++
mysqld.exe!handle_one_connection(void * arg=0x02554948) Line 737 + 0x9 C++
mysqld.exe!pthread_start(void * param=0x02559638) Line 63 + 0x7 C
mysqld.exe!_threadstart(void * ptd=0x0254be70) Line 173 + 0xd C
kernel32.dll!77e6d33b()
mysql> CREATE AGGREGATE FUNCTION avgcost RETURNS REAL SONAME "myudf.dll";
Query OK, 0 rows affected (0.01 sec)
mysql> select avgcost(30,23);
ERROR 2013: Lost connection to MySQL server during query
CALL STACK
myudf.dll!10001567()
mysqld.exe!Item_sum_udf_float::val() Line 1149 C++
mysqld.exe!Item_sum_udf_float::val_str(String * str=0x03a7f1f8)
Line 1153 + 0xb C++
mysqld.exe!Item::send(THD * thd=0x02555980, String *
packet=0x02555e50) Line 675 + 0x15 C++
mysqld.exe!select_send::send_data(List<Item> & items={...})
Line 490 + 0x16 C++
mysqld.exe!mysql_select(THD * thd=0x02555980, st_table_list
* tables=0x00000000, List<Item> & fields={...}, Item *
conds=0x00000000, st_order * order=0x00000000, st_order
* group=0x00000000, Item * having=0x00000000, st_order
* proc_param=0x00000000, unsigned long select_options=17339392,
select_result * result=0x0255da10) Line 445 + 0x18 C++
mysqld.exe!handle_select(THD * thd=0x02555980, st_lex * lex=0x02555ab0,
select_result * result=0x0255da10) Line 191 + 0x51 C++
mysqld.exe!mysql_execute_command() Line 1457 + 0x11 C++
mysqld.exe!mysql_parse(THD * thd=0x02555980, char * inBuf=0x0255d8b0,
unsigned int length=21) Line 3001 C++
mysqld.exe!dispatch_command(enum_server_command command=COM_QUERY,
THD * thd=0x02555980, char * packet=0x02559849,
unsigned int packet_length=21) Line 1083 + 0x17 C++
mysqld.exe!do_command(THD * thd=0x02555980) Line 953 + 0x31 C++
mysqld.exe!handle_one_connection(void * arg=0x02555980) Line 737 + 0x9 C++
mysqld.exe!pthread_start(void * param=0x02559638) Line 63 + 0x7 C
mysqld.exe!_threadstart(void * ptd=0x0254be80) Line 173 + 0xd C
kernel32.dll!77e6d33b()
How to repeat:
Use the myudf.dll attached like showed in the
description.
Portions of this website are copyright © 2001, 2002 The PHP Group
Page generated in 0.040 sec. using MySQL 8.4.7-u6-cloud
Timestamp references displayed by the system are UTC.
Content reproduced on this site is the property of the
respective copyright holders.
It is not reviewed in advance
by Oracle and does not necessarily represent the opinion of
Oracle or any other party.
Description: I created an VC++ project for to be added to the examples package release and the functions: sequence() and avgcost() crash the server disregarding the arguments how you can see below: Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 1 to server version: 4.0.20a-debug Type 'help;' or '\h' for help. Type '\c' to clear the buffer. mysql> CREATE FUNCTION metaphon RETURNS STRING SONAME "myudf.dll"; Query OK, 0 rows affected (0.25 sec) mysql> select metaphon("my test"); +---------------------+ | metaphon("my test") | +---------------------+ | MTST | +---------------------+ 1 row in set (0.12 sec) mysql> CREATE FUNCTION myfunc_double RETURNS REAL SONAME "myudf.dll"; Query OK, 0 rows affected (0.00 sec) mysql> select myfunc_double("my test"); +--------------------------+ | myfunc_double("my test") | +--------------------------+ | 101.42857142857 | +--------------------------+ 1 row in set (0.00 sec) mysql> CREATE FUNCTION myfunc_int RETURNS INTEGER SONAME "myudf.dll"; Query OK, 0 rows affected (0.00 sec) mysql> select myfunc_int("my test"); +-----------------------+ | myfunc_int("my test") | +-----------------------+ | 7 | +-----------------------+ 1 row in set (0.00 sec) mysql> CREATE FUNCTION sequence RETURNS INTEGER SONAME "myudf.dll"; Query OK, 0 rows affected (0.01 sec) mysql> select sequence(1); ERROR 2013: Lost connection to MySQL server during query mysql> select sequence("mytest"); ERROR 2013: Lost connection to MySQL server during query CALL STACK myudf.dll!10001541() mysqld.exe!Item_func_udf_int::val_int() Line 1407 C++ mysqld.exe!Item_func_udf_int::val_str(String * str=0x03a7f1f8) Line 1412 + 0xb C++ mysqld.exe!Item::send(THD * thd=0x02554948, String * packet=0x02554e18) Line 675 + 0x15 C++ mysqld.exe!select_send::send_data(List<Item> & items={...}) Line 490 + 0x16 C++ mysqld.exe!mysql_select(THD * thd=0x02554948, st_table_list * tables=0x00000000, List<Item> & fields={...}, Item * conds=0x00000000, st_order * order=0x00000000, st_order * group=0x00000000, Item * having=0x00000000, st_order * proc_param=0x00000000, unsigned long select_options=17339392, select_result * result=0x0255d9d8) Line 445 + 0x18 C++ mysqld.exe!handle_select(THD * thd=0x02554948, st_lex * lex=0x02554a78, select_result * result=0x0255d9d8) Line 191 + 0x51 C++ mysqld.exe!mysql_execute_command() Line 1457 + 0x11 C++ mysqld.exe!mysql_parse(THD * thd=0x02554948, char * inBuf=0x0255d8b0, unsigned int length=25) Line 3001 C++ mysqld.exe!dispatch_command(enum_server_command command=COM_QUERY, THD * thd=0x02554948, char * packet=0x02559849, unsigned int packet_length=25) Line 1083 + 0x17 C++ mysqld.exe!do_command(THD * thd=0x02554948) Line 953 + 0x31 C++ mysqld.exe!handle_one_connection(void * arg=0x02554948) Line 737 + 0x9 C++ mysqld.exe!pthread_start(void * param=0x02559638) Line 63 + 0x7 C mysqld.exe!_threadstart(void * ptd=0x0254be70) Line 173 + 0xd C kernel32.dll!77e6d33b() mysql> CREATE AGGREGATE FUNCTION avgcost RETURNS REAL SONAME "myudf.dll"; Query OK, 0 rows affected (0.01 sec) mysql> select avgcost(30,23); ERROR 2013: Lost connection to MySQL server during query CALL STACK myudf.dll!10001567() mysqld.exe!Item_sum_udf_float::val() Line 1149 C++ mysqld.exe!Item_sum_udf_float::val_str(String * str=0x03a7f1f8) Line 1153 + 0xb C++ mysqld.exe!Item::send(THD * thd=0x02555980, String * packet=0x02555e50) Line 675 + 0x15 C++ mysqld.exe!select_send::send_data(List<Item> & items={...}) Line 490 + 0x16 C++ mysqld.exe!mysql_select(THD * thd=0x02555980, st_table_list * tables=0x00000000, List<Item> & fields={...}, Item * conds=0x00000000, st_order * order=0x00000000, st_order * group=0x00000000, Item * having=0x00000000, st_order * proc_param=0x00000000, unsigned long select_options=17339392, select_result * result=0x0255da10) Line 445 + 0x18 C++ mysqld.exe!handle_select(THD * thd=0x02555980, st_lex * lex=0x02555ab0, select_result * result=0x0255da10) Line 191 + 0x51 C++ mysqld.exe!mysql_execute_command() Line 1457 + 0x11 C++ mysqld.exe!mysql_parse(THD * thd=0x02555980, char * inBuf=0x0255d8b0, unsigned int length=21) Line 3001 C++ mysqld.exe!dispatch_command(enum_server_command command=COM_QUERY, THD * thd=0x02555980, char * packet=0x02559849, unsigned int packet_length=21) Line 1083 + 0x17 C++ mysqld.exe!do_command(THD * thd=0x02555980) Line 953 + 0x31 C++ mysqld.exe!handle_one_connection(void * arg=0x02555980) Line 737 + 0x9 C++ mysqld.exe!pthread_start(void * param=0x02559638) Line 63 + 0x7 C mysqld.exe!_threadstart(void * ptd=0x0254be80) Line 173 + 0xd C kernel32.dll!77e6d33b() How to repeat: Use the myudf.dll attached like showed in the description.