summaryrefslogtreecommitdiff
path: root/ext/pgsql/tests
diff options
context:
space:
mode:
authorXinchen Hui <laruence@gmail.com>2016-05-12 13:15:33 +0800
committerXinchen Hui <laruence@gmail.com>2016-05-12 13:15:33 +0800
commit3c0341e6f9c802ff50cc4eb08e6b90793d033aad (patch)
treeb269125d9901cfeeccf9e297fb5a43aaee4d4137 /ext/pgsql/tests
parentdf404e2e0eb190cd40f8f04a237cb9b655022148 (diff)
downloadphp-git-3c0341e6f9c802ff50cc4eb08e6b90793d033aad.tar.gz
Fixed bug #72195 (pg_pconnect/pg_connect cause use-after-free)
Diffstat (limited to 'ext/pgsql/tests')
-rw-r--r--ext/pgsql/tests/bug72195.phpt17
-rw-r--r--ext/pgsql/tests/config.inc2
2 files changed, 18 insertions, 1 deletions
diff --git a/ext/pgsql/tests/bug72195.phpt b/ext/pgsql/tests/bug72195.phpt
new file mode 100644
index 0000000000..2f33e1ab1c
--- /dev/null
+++ b/ext/pgsql/tests/bug72195.phpt
@@ -0,0 +1,17 @@
+--TEST--
+Bug #72195 (pg_pconnect/pg_connect cause use-after-free)
+--SKIPIF--
+<?php include("skipif.inc"); ?>
+--FILE--
+<?php
+$val = [];
+$var1 = $val;
+printf("%x\n", count($val));
+@pg_pconnect($var1, "2", "3", "4");
+$var1 = "";
+tempnam('/tmp', 'ABCDEFGHI');
+printf("%x\n", count($val));
+?>
+--EXPECT--
+0
+0
diff --git a/ext/pgsql/tests/config.inc b/ext/pgsql/tests/config.inc
index e9944de793..7be1e242ad 100644
--- a/ext/pgsql/tests/config.inc
+++ b/ext/pgsql/tests/config.inc
@@ -5,7 +5,7 @@
// environment var PGSQL_TEST_CONNSTR
// "test" database must exist. i.e. "createdb test" before testing
-$conn_str = getenv('PGSQL_TEST_CONNSTR') ?: "host=localhost dbname=test port=5432"; // connection string
+$conn_str = getenv('PGSQL_TEST_CONNSTR') ?: "host=localhost dbname=test port=5432 user=postgres password=postgres"; // connection string
$table_name = "php_pgsql_test"; // test table that will be created
$table_name_92 = "php_pgsql_test_92"; // test table that will be created