Bug #6081 | executing mysql_create_db from PHP 5.02 ISAPI results in access violation | ||
---|---|---|---|
Submitted: | 14 Oct 2004 5:50 | Modified: | 22 Oct 2004 19:13 |
Reporter: | Casual Programmer | Email Updates: | |
Status: | Closed | Impact on me: | |
Category: | MySQL Server | Severity: | S2 (Serious) |
Version: | 4.1g | OS: | Windows (windows xp, sp2/Linux) |
Assigned to: | Dmitry Lenev | CPU Architecture: | Any |
[14 Oct 2004 5:50]
Casual Programmer
[14 Oct 2004 17:29]
MySQL Verification Team
mysql_create_db is a deprecated function, so the client library needs to be compiled according the below ifdef from libmysql.c: #ifdef USE_OLD_FUNCTIONS int STDCALL mysql_create_db(MYSQL *mysql, const char *db) { DBUG_ENTER("mysql_createdb"); DBUG_PRINT("enter",("db: %s",db)); DBUG_RETURN(simple_command(mysql,COM_CREATE_DB,db, (ulong) strlen(db),0)); } int STDCALL mysql_drop_db(MYSQL *mysql, const char *db) { DBUG_ENTER("mysql_drop_db"); DBUG_PRINT("enter",("db: %s",db)); DBUG_RETURN(simple_command(mysql,COM_DROP_DB,db,(ulong) strlen(db),0)); } #endif
[14 Oct 2004 18:16]
Casual Programmer
Hi Miguel, thanks for commenting. Actually I think deprecated code should be honored for backward compatibility and in no case should using deprecated code lead to the crash of the DB server. Also I have neither means nor intention to compile mySQL or PHP by myself. I suggest, that both mySQL and PHP go ahead and supply binaries that are tolerant to deprecated or even plain erroneus code. Casual
[14 Oct 2004 18:43]
MySQL Verification Team
Sorry, I just understood that your application crashed..I will test this if the server in fact crashs. Thank you for the warning.
[14 Oct 2004 23:48]
Hartmut Holzgraefe
verified on linux using PHP 4 built against the bundled 3.23 client lib
[15 Oct 2004 0:58]
MySQL Verification Team
How to repeat: Compile the mysqlclient library and the application application with: USE_OLD_FUNCTIONS /sql/sql_db.cc --245-- static bool write_db_opt(THD *thd, const char *path, HA_CREATE_INFO *create) { register File file; char buf[256]; // Should be enough for one option bool error=1; if (!create->default_table_charset) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ create->default_table_charset= thd->variables.collation_server; call stack: mysqld.exe!write_db_opt(THD * thd=0x02eb9300, const char * path=0x0557fa74, st_ha_create_information * create=0x00000000) Line 251 + 0x3 C++ mysqld.exe!mysql_create_db(THD * thd=0x02eb9300, char * db=0x00e68218, st_ha_create_information * create_info=0x00000000, int silent=0) Line 437 + 0x14 C++ mysqld.exe!dispatch_command(enum_server_command command=COM_CREATE_DB, THD * thd=0x02eb9300, char * packet=0x02eba699, unsigned int packet_length=6) Line 1570 + 0x37 C++ mysqld.exe!do_command(THD * thd=0x02eb9300) Line 1271 + 0x31 C++ mysqld.exe!handle_one_connection(void * arg=0x02eb9300) Line 1015 + 0x9 C++ mysqld.exe!pthread_start(void * param=0x00e6d600) Line 63 + 0x7 C mysqld.exe!_threadstart(void * ptd=0x00e6ff48) Line 173 + 0xd C kernel32.dll!7c80b50b() kernel32.dll!7c8399f3() mysqld.exe!mysql_load(THD * thd=0x0072006f, sql_exchange * ex=0x0061006d, st_table_list * table_list=0x0053006c, List<Item> & fields={...}, enum_duplicates handle_duplicates=101, int read_file_from_client=7077991, thr_lock_type lock_type=6422639) Line 163 + 0x16 C++ mysqld.exe!mysql_load(THD * thd=0xcc017501, sql_exchange * ex=0xd285d233, st_table_list * table_list=0xb0a1a775, List<Item> & fields={...}, enum_duplicates handle_duplicates=-1065024288, int read_file_from_client=12944655, thr_lock_type lock_type=74055680) Line 163 + 0x16 C++ f88314c4()
[17 Oct 2004 10:01]
Dmitry Lenev
ChangeSet 1.2107 04/10/17 13:59:46 dlenev@brandersnatch.localdomain +2 -0 Fix for bug #6081 "Call to deprecated mysql_create_db() function crashes server".
[22 Oct 2004 19:13]
Dmitry Lenev
Thank you for your bug report. This issue has been committed to our source repository of that product and will be incorporated into the next release. If necessary, you can access the source repository and build the latest available version, including the bugfix, yourself. More information about accessing the source trees is available at http://www.mysql.com/doc/en/Installing_source_tree.html Additional info: Fix will be in 4.1.7 Also the problem with erroneus call to mysql_create_db()/mysql_drop_db() stalling connection which was exposed during work on this bug was fixed in 4.0.