php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #48909 Segmentation fault in mysqli_stmt_execute
Submitted: 2009-07-13 20:40 UTC Modified: 2009-09-18 18:38 UTC
From: etremblay at kronostechnologies dot com Assigned:
Status: Closed Package: MySQLi related
PHP Version: 5.3.2-dev (cli) (built: Sep 17 2009 08:48:06) OS: Kubuntu jaunty
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: etremblay at kronostechnologies dot com
New email:
PHP Version: OS:

 

 [2009-07-13 20:40 UTC] etremblay at kronostechnologies dot com
Description:
------------
I'have not yet isolated the problem, but since updating to 5.3.0 (snapshot), some prepared statement cause segmentation fault.

Reproduce code:
---------------
NOTE : Fields 0 to 4 are php serialized objects.

$update_stmt->bind_param('bbbbbs', $bidon, $bidon, $bidon, $bidon, $bidon,$system_name);
						$update_stmt->send_long_data(0, $serializedFieldRef);					$update_stmt->send_long_data(1, $serializedFieldRef2);					$update_stmt->send_long_data(2, $serializedFieldRef3);					$update_stmt->send_long_data(3, $serializedFieldRef4);					$update_stmt->send_long_data(4, $serializedSelection);					$update_stmt->execute();

Expected result:
----------------
The query is executed

Actual result:
--------------
Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0xb74589f0 (LWP 16404)]
0x0828a9f7 in php_mysqli_stmt_copy_it (copies=0xbfeb9540, original=0x0, param_count=6, current=0) at /opt/php5.3-200907131830/ext/mysqli/mysqli_api.c:706
706             *(*copies)[current] = *original;
(gdb) bt
#0  0x0828a9f7 in php_mysqli_stmt_copy_it (copies=0xbfeb9540, original=0x0, param_count=6, current=0) at /opt/php5.3-200907131830/ext/mysqli/mysqli_api.c:706
#1  0x0828abb4 in zif_mysqli_stmt_execute (ht=0, return_value=0xce3fd30, return_value_ptr=0x0, this_ptr=0xce3ca90, return_value_used=0) at /opt/php5.3-200907131830/ext/mysqli/mysqli_api.c:736
#2  0x084d1a4a in zend_do_fcall_common_helper_SPEC (execute_data=0xa266414) at /opt/php5.3-200907131830/Zend/zend_vm_execute.h:313
#3  0x084d2650 in ZEND_DO_FCALL_BY_NAME_SPEC_HANDLER (execute_data=0xa266414) at /opt/php5.3-200907131830/Zend/zend_vm_execute.h:422
#4  0x084d0eba in execute (op_array=0xa24f678) at /opt/php5.3-200907131830/Zend/zend_vm_execute.h:104
#5  0x084a6520 in zend_execute_scripts (type=8, retval=0x0, file_count=3) at /opt/php5.3-200907131830/Zend/zend.c:1188
#6  0x0843c30f in php_execute_script (primary_file=0xbfebb9c4) at /opt/php5.3-200907131830/main/main.c:2212
#7  0x085668d5 in main (argc=7, argv=0xbfebbb34) at /opt/php5.3-200907131830/sapi/cli/php_cli.c:1188

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2009-07-13 21:43 UTC] etremblay at kronostechnologies dot com
I'have compiled php with mysqlnd (--with-mysqli=mysqlnd) and the problem is solved.

Note that with earlyer version of php, 5.2.9, there was no problem with libmysql and the same query.
 [2009-09-17 11:53 UTC] uw@php.net
Good too hear that it does not happen with mysqlnd. 

It is hard to comment without a reproducible test case. 

If you cannot isolate the issue, maybe you can check if the problem exists with the latest version of the MySQL Client Library and maybe you can even use a debug version?

Thanks
 [2009-09-17 13:06 UTC] etremblay at kronostechnologies dot com
I just retryed with today php snapshot (php5.3-200909171030)

With  --with-mysql --with-mysqli
MysqlI Support => enabled
Client API library version => 5.0.75
Active Persistent Links => 0        
Inactive Persistent Links => 0      
Active Links => 0                   
Client API header version => 5.0.75 
MYSQLI_SOCKET => /var/run/mysqld/mysqld.sock

I still got the segementation fault.

With --with-mysql=mysqlnd --with-mysql=mysqlnd
The same query work fine.

I'm affraid I haven't mutch more time to spend on it.
 [2009-09-17 13:13 UTC] uw@php.net
Problem remains: we need a reproducible test case. So, please try to isolate a test. 

Also, using snapshot may not matter. It may be a matter of the MySQL Client Library. Make sure that you use the latest version of the MySQL Client library when compiling PHP.

Thanks!
 [2009-09-18 14:32 UTC] svn@php.net
Automatic comment from SVN on behalf of andrey
Revision: http://svn.php.net/viewvc/?view=revision&revision=288438
Log: Fix for bug#48909 Segmentation fault in mysqli_stmt_execute
 [2009-09-18 14:33 UTC] svn@php.net
Automatic comment from SVN on behalf of andrey
Revision: http://svn.php.net/viewvc/?view=revision&revision=288439
Log: MFH:Fix for bug#48909 Segmentation fault in mysqli_stmt_execute
 [2009-09-18 14:38 UTC] andrey@php.net
This bug has been fixed in SVN.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
 
Thank you for the report, and for helping us make PHP better.

Thank you!
 [2009-09-18 18:38 UTC] jani@php.net
Let's not invent our own versions..
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Nov 21 13:01:29 2024 UTC