Merge branch 'PHP-7.4' into master

* PHP-7.4:
  Fix #67465: NULL Pointer dereference in odbc_handle_preparer
This commit is contained in:
Christoph M. Becker 2020-09-28 22:59:51 +02:00
commit 99b3631e9a
2 changed files with 19 additions and 1 deletions

View File

@ -177,6 +177,8 @@ static int odbc_handle_preparer(pdo_dbh_t *dbh, const char *sql, size_t sql_len,
return 0;
}
stmt->driver_data = S;
cursor_type = pdo_attr_lval(driver_options, PDO_ATTR_CURSOR, PDO_CURSOR_FWDONLY);
if (cursor_type != PDO_CURSOR_FWDONLY) {
rc = SQLSetStmtAttr(S->stmt, SQL_ATTR_CURSOR_SCROLLABLE, (void*)SQL_SCROLLABLE, 0);
@ -195,7 +197,6 @@ static int odbc_handle_preparer(pdo_dbh_t *dbh, const char *sql, size_t sql_len,
efree(nsql);
}
stmt->driver_data = S;
stmt->methods = &odbc_stmt_methods;
if (rc != SQL_SUCCESS) {

View File

@ -0,0 +1,17 @@
--TEST--
Bug #67465 (NULL Pointer dereference in odbc_handle_preparer)
--SKIPIF--
<?php
if (!extension_loaded('pdo_odbc')) die('skip pdo_odbc extension not available');
require 'ext/pdo/tests/pdo_test.inc';
PDOTest::skip();
?>
--FILE--
<?php
require 'ext/pdo/tests/pdo_test.inc';
$db = PDOTest::test_factory(dirname(__FILE__) . '/common.phpt');
$db->prepare("SELECT 1", [PDO::ATTR_CURSOR => PDO::CURSOR_SCROLL]);
echo "done\n";
?>
--EXPECT--
done