pierrick Tue, 27 Apr 2010 05:56:56 +0000 Revision: http://svn.php.net/viewvc?view=revision&revision=298637
Log: Fixed bug #51670 getColumnMeta causes segfault when re-executing query after calling nextRowset Bug: http://bugs.php.net/51670 (Open) getColumnMeta causes segfault when re-executing query after calling nextRowset Changed paths: U php/php-src/branches/PHP_5_2/NEWS U php/php-src/branches/PHP_5_2/ext/pdo/pdo_stmt.c A php/php-src/branches/PHP_5_2/ext/pdo_mysql/tests/bug_51670.phpt U php/php-src/branches/PHP_5_3/NEWS U php/php-src/branches/PHP_5_3/ext/pdo/pdo_stmt.c A php/php-src/branches/PHP_5_3/ext/pdo_mysql/tests/bug_51670.phpt U php/php-src/trunk/ext/pdo/pdo_stmt.c A php/php-src/trunk/ext/pdo_mysql/tests/bug_51670.phpt Modified: php/php-src/branches/PHP_5_2/NEWS =================================================================== --- php/php-src/branches/PHP_5_2/NEWS 2010-04-27 05:52:35 UTC (rev 298636) +++ php/php-src/branches/PHP_5_2/NEWS 2010-04-27 05:56:56 UTC (rev 298637) @@ -14,6 +14,8 @@ - Fixed handling of session variable serialization on certain prefix characters. Reported by Stefan Esser (Ilia) +- Fixed bug #51670 (getColumnMeta causes segfault when re-executing query + after calling nextRowset). (Pierrick) - Fixed bug #51629 (CURLOPT_FOLLOWLOCATION error message is misleading). (Pierre) - Fixed bug #51617 (PDO PGSQL still broken against PostGreSQL < 7.4). Modified: php/php-src/branches/PHP_5_2/ext/pdo/pdo_stmt.c =================================================================== --- php/php-src/branches/PHP_5_2/ext/pdo/pdo_stmt.c 2010-04-27 05:52:35 UTC (rev 298636) +++ php/php-src/branches/PHP_5_2/ext/pdo/pdo_stmt.c 2010-04-27 05:56:56 UTC (rev 298637) @@ -2089,6 +2089,8 @@ } if (!stmt->methods->next_rowset(stmt TSRMLS_CC)) { + /* Set the executed flag to 0 to reallocate columns on next execute */ + stmt->executed = 0; return 0; } Added: php/php-src/branches/PHP_5_2/ext/pdo_mysql/tests/bug_51670.phpt =================================================================== --- php/php-src/branches/PHP_5_2/ext/pdo_mysql/tests/bug_51670.phpt (rev 0) +++ php/php-src/branches/PHP_5_2/ext/pdo_mysql/tests/bug_51670.phpt 2010-04-27 05:56:56 UTC (rev 298637) @@ -0,0 +1,24 @@ +--TEST-- +Bug #51670 (getColumnMeta causes segfault when re-executing query after calling nextRowset) +--SKIPIF-- +<?php +if (!extension_loaded('pdo') || !extension_loaded('pdo_mysql')) die('skip not loaded'); +require dirname(__FILE__) . '/config.inc'; +require dirname(__FILE__) . '/../../../ext/pdo/tests/pdo_test.inc'; +PDOTest::skip(); +?> +--FILE-- +<?php +require dirname(__FILE__) . '/../../../ext/pdo/tests/pdo_test.inc'; +$db = PDOTest::test_factory(dirname(__FILE__) . '/common.phpt'); +$query = $db->prepare('SELECT 1 AS num'); +$query->execute(); +if(!is_array($query->getColumnMeta(0))) die('FAIL!'); +$query->nextRowset(); +$query->execute(); +if(!is_array($query->getColumnMeta(0))) die('FAIL!'); +echo 'done!'; +?> +--EXPECTF-- +done! + Modified: php/php-src/branches/PHP_5_3/NEWS =================================================================== --- php/php-src/branches/PHP_5_3/NEWS 2010-04-27 05:52:35 UTC (rev 298636) +++ php/php-src/branches/PHP_5_3/NEWS 2010-04-27 05:56:56 UTC (rev 298637) @@ -21,7 +21,9 @@ characters. Reported by Stefan Esser (Ilia) - Fixed a NULL pointer dereference when processing invalid XML-RPC requests (Fixes CVE-2010-0397, bug #51288). (Raphael Geissert) -- Fixed 64-bit integer overflow in mhash_keygen_s2k(). (Clément LECIGNE, Stas) +- Fixed 64-bit integer overflow in mhash_keygen_s2k(). (Clément LECIGNE, Stas) +- Fixed bug #51670 (getColumnMeta causes segfault when re-executing query + after calling nextRowset). (Pierrick) - Fixed bug #51647 Certificate file without private key (pk in another file) doesn't work. (Andrey) - Fixed bug #51629 (CURLOPT_FOLLOWLOCATION error message is misleading). Modified: php/php-src/branches/PHP_5_3/ext/pdo/pdo_stmt.c =================================================================== --- php/php-src/branches/PHP_5_3/ext/pdo/pdo_stmt.c 2010-04-27 05:52:35 UTC (rev 298636) +++ php/php-src/branches/PHP_5_3/ext/pdo/pdo_stmt.c 2010-04-27 05:56:56 UTC (rev 298637) @@ -2080,6 +2080,8 @@ } if (!stmt->methods->next_rowset(stmt TSRMLS_CC)) { + /* Set the executed flag to 0 to reallocate columns on next execute */ + stmt->executed = 0; return 0; } Added: php/php-src/branches/PHP_5_3/ext/pdo_mysql/tests/bug_51670.phpt =================================================================== --- php/php-src/branches/PHP_5_3/ext/pdo_mysql/tests/bug_51670.phpt (rev 0) +++ php/php-src/branches/PHP_5_3/ext/pdo_mysql/tests/bug_51670.phpt 2010-04-27 05:56:56 UTC (rev 298637) @@ -0,0 +1,24 @@ +--TEST-- +Bug #51670 (getColumnMeta causes segfault when re-executing query after calling nextRowset) +--SKIPIF-- +<?php +if (!extension_loaded('pdo') || !extension_loaded('pdo_mysql')) die('skip not loaded'); +require dirname(__FILE__) . '/config.inc'; +require dirname(__FILE__) . '/../../../ext/pdo/tests/pdo_test.inc'; +PDOTest::skip(); +?> +--FILE-- +<?php +require dirname(__FILE__) . '/../../../ext/pdo/tests/pdo_test.inc'; +$db = PDOTest::test_factory(dirname(__FILE__) . '/common.phpt'); +$query = $db->prepare('SELECT 1 AS num'); +$query->execute(); +if(!is_array($query->getColumnMeta(0))) die('FAIL!'); +$query->nextRowset(); +$query->execute(); +if(!is_array($query->getColumnMeta(0))) die('FAIL!'); +echo 'done!'; +?> +--EXPECTF-- +done! + Modified: php/php-src/trunk/ext/pdo/pdo_stmt.c =================================================================== --- php/php-src/trunk/ext/pdo/pdo_stmt.c 2010-04-27 05:52:35 UTC (rev 298636) +++ php/php-src/trunk/ext/pdo/pdo_stmt.c 2010-04-27 05:56:56 UTC (rev 298637) @@ -2080,6 +2080,8 @@ } if (!stmt->methods->next_rowset(stmt TSRMLS_CC)) { + /* Set the executed flag to 0 to reallocate columns on next execute */ + stmt->executed = 0; return 0; } Added: php/php-src/trunk/ext/pdo_mysql/tests/bug_51670.phpt =================================================================== --- php/php-src/trunk/ext/pdo_mysql/tests/bug_51670.phpt (rev 0) +++ php/php-src/trunk/ext/pdo_mysql/tests/bug_51670.phpt 2010-04-27 05:56:56 UTC (rev 298637) @@ -0,0 +1,24 @@ +--TEST-- +Bug #51670 (getColumnMeta causes segfault when re-executing query after calling nextRowset) +--SKIPIF-- +<?php +if (!extension_loaded('pdo') || !extension_loaded('pdo_mysql')) die('skip not loaded'); +require dirname(__FILE__) . '/config.inc'; +require dirname(__FILE__) . '/../../../ext/pdo/tests/pdo_test.inc'; +PDOTest::skip(); +?> +--FILE-- +<?php +require dirname(__FILE__) . '/../../../ext/pdo/tests/pdo_test.inc'; +$db = PDOTest::test_factory(dirname(__FILE__) . '/common.phpt'); +$query = $db->prepare('SELECT 1 AS num'); +$query->execute(); +if(!is_array($query->getColumnMeta(0))) die('FAIL!'); +$query->nextRowset(); +$query->execute(); +if(!is_array($query->getColumnMeta(0))) die('FAIL!'); +echo 'done!'; +?> +--EXPECTF-- +done! +
-- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php