Bug #2181 mysql_execute without bind segfaults in embedded
Submitted: 21 Dec 2003 13:57 Modified: 23 Dec 2003 5:23
Reporter: Georg Richter Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Embedded Library ( libmysqld ) Severity:S3 (Non-critical)
Version:4.1 OS:Linux (Linux)
Assigned to: Alexey Botchkov CPU Architecture:Any

[21 Dec 2003 13:57] Georg Richter
Description:
calling mysql_execute without prior bind segfaults instead to give an error. 

How to repeat:
<cut> 
mysql_server_init(0,NULL,NULL); 
mysql_real_connect(mysql, NULL, NULL, NULL, "test", 0, NULL, 0); 
 
mysql_query(mysql, "CREATE TABLE a (a int)"); 
mysql_query(mysql, "INSERT INTO a VALUES (1)"); 
 
stmt = mysql_prepare(mysql, "DELETE FROM foo WHERE a=?", 100); 
mysql_execute(stmt);   /* <-- crash */ 
</cut> 
 
 
Backtrace: 
(gdb) bt 
#0  0x080508a6 in setup_params_data(st_prep_stmt*) (stmt=0xa5a5a5a5) at 
lib_sql.cc:762 
#1  0x080ca9aa in mysql_stmt_execute(THD*, char*) (thd=0x8409348, 
packet=0xa5a5a5a5 "") at sql_prepare.cc:984 
#2  0x080c21bc in dispatch_command(enum_server_command, THD*, char*, unsigned) 
(command=COM_EXECUTE, thd=0x8409348, packet=0x840d37c "\001", packet_length=5) 
at sql_parse.cc:1355 
#3  0x0804f690 in emb_advanced_command (mysql=0x8408f88, command=2779096485, 
header=0x0, header_length=0, arg=0x840d37c "\001", arg_length=4, skip_check=1 
'\001') at lib_sql.cc:84 
#4  0x0804f9a6 in emb_stmt_execute (stmt=0x840d328) at lib_sql.cc:190 
#5  0x0805531c in mysql_execute (stmt=0x840d328) at libmysql.c:2102 
#6  0x0804b2bb in main () at test.c:23
[23 Dec 2003 5:23] Alexey Botchkov
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:

bk commit - 4.1 tree (hf:1.1708)