Bug #1500 Server crash with mysql_prepare
Submitted: 7 Oct 2003 16:58 Modified: 23 Nov 2003 2:21
Reporter: Georg Richter
Status: Closed
Category:Server Severity:S3 (Non-critical)
Version:4.1.1 OS:Linux (Linux)
Assigned to: Dmitri Lenev Target Version:

[7 Oct 2003 16:58] Georg Richter
Description:
mysql_prepare(mysql, "SELECT column FROM table where field in (?,?,?)" crashes server.

Stacktrace:

0x8145703 handle_segfault + 453
0x40044895 _end + 934820053
0x832c90f my_strntod_8bit + 43
0x80d7fb6 _ZN10Item_param3valEv + 76
0x80f7567 _ZN9in_double3setEjP4Item + 17
0x80f7d12 _ZN12Item_func_in18fix_length_and_decEv + 506
0x80e7b0b _ZN9Item_func10fix_fieldsEP3THDP13st_table_listPP4Item + 323
0x8176af1 _Z11setup_condsP3THDP13st_table_listPP4Item + 161
0x817b869
_ZN4JOIN7prepareEPPP4ItemP13st_table_listjS1_jP8st_orderS7_S1_S7_P13st_select_lexP18st_sel
ect_lex_unitb + 467
0x819830e
_Z24mysql_test_select_fieldsP12st_prep_stmtP13st_table_listjR4ListI4ItemEPS4_jP8st_orderS9
_S7_S9_mP18st_select_lex_unitP13st_se + 790
0x81985a9 _Z20send_prepare_resultsP12st_prep_stmt + 451
0x8198701 _Z19parse_prepare_queryP12st_prep_stmtPcj + 195
0x8198acb _Z18mysql_stmt_prepareP3THDPcj + 407
0x815672e _Z16dispatch_command19enum_server_commandP3THDPcj + 1534
0x8156124 _Z10do_commandP3THD + 506
0x815561b handle_one_connection + 579
0x4003ec60 _end + 934796448
0x401e1b77 _end + 936512439

How to repeat:
	...
	mysql_query(mysql, "CREATE TABLE a (a int)");
	mysql_query(mysql, "INSERT INTO a VALUES
(1),(2),(3),(4),(5),(6),(7),(8),(9),(10),(11),(12),(13),(14)");
	
	stmt = mysql_prepare(mysql, "SELECT * FROM a WHERE a IN (?,?,?,?,?)",100);
[23 Nov 2003 2:16] Dmitri Lenev
Hi, Georg!

Thank you for you bug-report! This bug was fixed and patch was commited to our source
repository so it will be incorporated into the next release.

Though there are some other still unfixed issues (see bug #1663), which 
doesn't allow normal usage of prepared statements. 

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
[23 Nov 2003 2:21] Dmitri Lenev
ChangeSet 1.1620.3.1 2003/11/23 00:48:18 dlenev@dlenev.mshome
  Fix for bug #1500 "Server crash with mysql_prepare" ...