#37621 [NEW]: bind_param goes out of memory with wrong arguments

From: Date: Mon, 29 May 2006 01:52:26 +0000
Subject: #37621 [NEW]: bind_param goes out of memory with wrong arguments
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-97712@lists.php.net to get a copy of this message
From:             michal at logix dot cz
Operating system: Linux
PHP version:      5.1.4
PHP Bug Type:     MySQLi related
Bug description:  bind_param goes out of memory with wrong arguments

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.

-- 
Edit bug report at http://bugs.php.net/?id=37621&edit=1
-- 
Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=37621&r=trysnapshot44
Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=37621&r=trysnapshot52
Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=37621&r=trysnapshot60
Fixed in CVS:                 http://bugs.php.net/fix.php?id=37621&r=fixedcvs
Fixed in release:             http://bugs.php.net/fix.php?id=37621&r=alreadyfixed
Need backtrace:               http://bugs.php.net/fix.php?id=37621&r=needtrace
Need Reproduce Script:        http://bugs.php.net/fix.php?id=37621&r=needscript
Try newer version:            http://bugs.php.net/fix.php?id=37621&r=oldversion
Not developer issue:          http://bugs.php.net/fix.php?id=37621&r=support
Expected behavior:            http://bugs.php.net/fix.php?id=37621&r=notwrong
Not enough info:              http://bugs.php.net/fix.php?id=37621&r=notenoughinfo
Submitted twice:              http://bugs.php.net/fix.php?id=37621&r=submittedtwice
register_globals:             http://bugs.php.net/fix.php?id=37621&r=globals
PHP 3 support discontinued:   http://bugs.php.net/fix.php?id=37621&r=php3
Daylight Savings:             http://bugs.php.net/fix.php?id=37621&r=dst
IIS Stability:                http://bugs.php.net/fix.php?id=37621&r=isapi
Install GNU Sed:              http://bugs.php.net/fix.php?id=37621&r=gnused
Floating point limitations:   http://bugs.php.net/fix.php?id=37621&r=float
No Zend Extensions:           http://bugs.php.net/fix.php?id=37621&r=nozend
MySQL Configuration Error:    http://bugs.php.net/fix.php?id=37621&r=mysqlcfg


Thread (5 messages)

« previous php.bugs (#97712) next »