php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #42978 prepared statement bind mismatch causes zend_mm_heap corruption
Submitted: 2007-10-15 17:21 UTC Modified: 2007-11-20 14:23 UTC
From: ahawthorne at rook dot ca Assigned: iliaa (profile)
Status: Closed Package: PDO related
PHP Version: 5.2.4 OS: Fedora 6
Private report: No CVE-ID: None
 [2007-10-15 17:21 UTC] ahawthorne at rook dot ca
Description:
------------
Having a prepared statement with a given number of parameters (ie. ?,?) and binding two more parameters than required causes zend_mm_heap corruption where an error is expected.



Reproduce code:
---------------
// NOTE: I'm running PostgreSQL 8.2.3

$db = new e4_PDO($db_connect_string);

$item = array(112,113,114);

$sql = "SELECT * FROM item_table WHERE item_id IN (?)";
$stmt = $db->prepare($sql);

$stmt->bindValue(1,$item[0]);
$stmt->bindValue(2,$item[1]);
$stmt->bindValue(3,$item[2]);

$stmt->execute();



Expected result:
----------------
something like:
ERROR:  bind message supplies 3 parameters, but prepared statement "pdo_pgsql_stmt_XXXXXXXX" requires 1

Actual result:
--------------
zend_mm_heap corrupted

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2007-10-15 22:21 UTC] ahawthorne at rook dot ca
I compiled and installed the latest CVS snapshot but the problem still persists. The Same code returns the same error.
 [2007-11-20 14:23 UTC] iliaa@php.net
This bug has been fixed in CVS.

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.


 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Mon Dec 30 14:01:28 2024 UTC