php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #37621 bind_param goes out of memory with wrong arguments
Submitted: 2006-05-29 01:52 UTC Modified: 2006-05-30 12:17 UTC
From: michal at logix dot cz Assigned: georg (profile)
Status: Closed Package: MySQLi related
PHP Version: 5.1.4 OS: Linux
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem:
40 - 6 = ?
Subscribe to this entry?

 
 [2006-05-29 01:52 UTC] michal at logix dot cz
Description:
------------
When using MySQLi->bind_param() I noticed it will go out of memory when supplied with wrong arguments, e.g.:

$db->bind_param("sss", $param1, $param2);

Note there are three 's' but only two parameters. This line never returns in my script and instead the httpd process dies with OOM. Once deleted one of the 's' it plays well again.

Using Apache 2.0.58, PHP 5.1.4 and MySQL 4.1.10a on SUSE Linux 9.3/x86.

Reproduce code:
---------------
$query = "SELECT cookie FROM cookies ".
         "WHERE username = ? AND sessionid = ? ".
         "AND expiration > NOW() ORDER BY expiration DESC ".
         "LIMIT 1";
$stmt = $db->prepare($query);
$stmt->bind_param("sss", $username, $sessionid);
[...]

Expected result:
----------------
Fail gracefully.

Actual result:
--------------
Goes out of memory, killing httpd thread.

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2006-05-29 17:02 UTC] mike@php.net
Please try using this CVS snapshot:

  http://snaps.php.net/php5.2-latest.tar.gz
 
For Windows:
 
  http://snaps.php.net/win32/php5.2-win32-latest.zip


 [2006-05-30 00:00 UTC] michal at logix dot cz
Cool, gives me a warning now: "Warning: mysqli_stmt::bind_param() [function.mysqli-stmt-bind-param]: Number of elements in type definition string doesn't match number of bind variables in /.../server-mgr.php on line 175"

Thanks for the fix!
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Mon Apr 29 11:01:32 2024 UTC