From 29ac511b8afabaee27133bb3582142a49154eab5 Mon Sep 17 00:00:00 2001 From: Anatol Belski Date: Wed, 10 Jul 2013 13:00:47 +0200 Subject: [PATCH 1/9] fix possible resource leak and make sure there's something to qsort() --- main/streams/streams.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/main/streams/streams.c b/main/streams/streams.c index cb80e9a16b..a835c25d9d 100644 --- a/main/streams/streams.c +++ b/main/streams/streams.c @@ -2358,6 +2358,7 @@ PHPAPI int _php_stream_scandir(char *dirname, char **namelist[], int flags, php_ } else { if(vector_size*2 < vector_size) { /* overflow */ + php_stream_closedir(stream); efree(vector); return FAILURE; } @@ -2371,6 +2372,7 @@ PHPAPI int _php_stream_scandir(char *dirname, char **namelist[], int flags, php_ nfiles++; if(vector_size < 10 || nfiles == 0) { /* overflow */ + php_stream_closedir(stream); efree(vector); return FAILURE; } @@ -2379,7 +2381,7 @@ PHPAPI int _php_stream_scandir(char *dirname, char **namelist[], int flags, php_ *namelist = vector; - if (compare) { + if (nfiles > 0 && compare) { qsort(*namelist, nfiles, sizeof(char *), (int(*)(const void *, const void *))compare); } return nfiles; From c7490a6edd9b11a89712cae74aa11339fb8d1e68 Mon Sep 17 00:00:00 2001 From: Anatol Belski Date: Wed, 10 Jul 2013 16:16:33 +0200 Subject: [PATCH 2/9] add usleep() to the header, already exported to dll --- win32/time.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/win32/time.h b/win32/time.h index f841a2b601..d5d86eb1ed 100644 --- a/win32/time.h +++ b/win32/time.h @@ -50,4 +50,6 @@ PHPAPI extern int setitimer(int which, const struct itimerval *value, PHPAPI int nanosleep( const struct timespec * rqtp, struct timespec * rmtp ); +PHPAPI int usleep(unsigned int useconds); + #endif From 710eee5555bc5c95692bd3c84f5d2b5d687349b6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Johannes=20Schl=C3=BCter?= Date: Wed, 10 Jul 2013 19:35:18 +0200 Subject: [PATCH 3/9] add test for bug #65236 --- ext/xml/tests/bug65236.phpt | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 ext/xml/tests/bug65236.phpt diff --git a/ext/xml/tests/bug65236.phpt b/ext/xml/tests/bug65236.phpt new file mode 100644 index 0000000000..67b26d663f --- /dev/null +++ b/ext/xml/tests/bug65236.phpt @@ -0,0 +1,15 @@ +--TEST-- +Bug #65236 (heap corruption in xml parser) +--SKIPIF-- + +--FILE-- +", 1000), $a); + +echo "Done\n"; +?> +--EXPECTF-- +Warning: xml_parse_into_struct(): Maximum depth exceeded - Results truncated in %s on line %d +Done From 9c4ef501462cb672df1f6736261a1c8beea77c7e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Johannes=20Schl=C3=BCter?= Date: Wed, 10 Jul 2013 19:45:45 +0200 Subject: [PATCH 4/9] Merge PHP 5.3.27 NEWS --- NEWS | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/NEWS b/NEWS index d006da0a52..0e498b0b41 100644 --- a/NEWS +++ b/NEWS @@ -2,12 +2,7 @@ PHP NEWS ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| ?? ??? 2013, PHP 5.3.28 -?? ??? 2013, PHP 5.3.27 - -### -### DO NOT ADD ENTRIES HERE -### All entries go to 5.3.28 -### +11 Jul 2013, PHP 5.3.27 - Core: . Fixed bug #64966 (segfault in zend_do_fcall_common_helper_SPEC). (Laruence) @@ -35,6 +30,9 @@ PHP NEWS . Fixed bug #64997 (Segfault while using RecursiveIteratorIterator on 64-bits systems). (Laruence) +- XML: + . Fixed bug #65236 (heap corruption in xml parser). (Rob) + 06 Jun 2013, PHP 5.3.26 - Core: From 3478ddc1f057d379bbe4b9524c4d208ed81bb309 Mon Sep 17 00:00:00 2001 From: Christopher Jones Date: Wed, 10 Jul 2013 11:17:52 -0700 Subject: [PATCH 5/9] Cleanup temp test file --- ext/spl/tests/SplFileObject_rewind_error001.phpt | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/ext/spl/tests/SplFileObject_rewind_error001.phpt b/ext/spl/tests/SplFileObject_rewind_error001.phpt index bdb3301e63..ac536a0a44 100644 --- a/ext/spl/tests/SplFileObject_rewind_error001.phpt +++ b/ext/spl/tests/SplFileObject_rewind_error001.phpt @@ -13,6 +13,10 @@ $fo = new SplFileObject('testdata.csv'); $fo->rewind( "invalid" ); +?> +--CLEAN-- + --EXPECTF-- Warning: SplFileObject::rewind() expects exactly 0 parameters, 1 given in %s on line %d From 2acc38627092123ac462f3a23780bf887bf69286 Mon Sep 17 00:00:00 2001 From: Anatol Belski Date: Thu, 11 Jul 2013 00:48:12 +0200 Subject: [PATCH 6/9] Fixed bug #65226 chroot() does not get enabled --- NEWS | 1 + ext/standard/config.m4 | 24 +++++++++++++++++++++++- 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/NEWS b/NEWS index d20ec7ebbe..eef3c06873 100644 --- a/NEWS +++ b/NEWS @@ -13,6 +13,7 @@ PHP NEWS . Fixed bug #62475 (variant_* functions causes crash when null given as an argument). (Felipe) . Fixed bug #60732 (php_error_docref links to invalid pages). (Jakub Vrana) + . Fixed bug #65226 (chroot() does not get enabled). (Anatol) - CGI: . Fixed Bug #65143 (Missing php-cgi man page). (Remi) diff --git a/ext/standard/config.m4 b/ext/standard/config.m4 index c33ae1e05c..c1f5aff7c2 100644 --- a/ext/standard/config.m4 +++ b/ext/standard/config.m4 @@ -358,7 +358,29 @@ else AC_MSG_RESULT(no) fi -if test "$PHP_SAPI" = "cgi" || test "$PHP_SAPI" = "cli" || test "$PHP_SAPI" = "embed"; then +PHP_ENABLE_CHROOT_FUNC=no +case "$PHP_SAPI" in + embed) + PHP_ENABLE_CHROOT_FUNC=yes + ;; + + none) + for PROG in $PHP_BINARIES; do + case "$PROG" in + cgi|cli) + PHP_ENABLE_CHROOT_FUNC=yes + ;; + + *) + PHP_ENABLE_CHROOT_FUNC=no + break + ;; + esac + done + ;; +esac + +if test "$PHP_ENABLE_CHROOT_FUNC" = "yes"; then AC_DEFINE(ENABLE_CHROOT_FUNC, 1, [Whether to enable chroot() function]) fi From 4f4fa32ca51a41080ddf8fe0f4ad0685f37c3e5a Mon Sep 17 00:00:00 2001 From: Anatol Belski Date: Thu, 11 Jul 2013 00:51:10 +0200 Subject: [PATCH 7/9] updated NEWS --- NEWS | 1 + 1 file changed, 1 insertion(+) diff --git a/NEWS b/NEWS index 3ba0e47706..65fbb5ff26 100644 --- a/NEWS +++ b/NEWS @@ -10,6 +10,7 @@ PHP NEWS . Fixed bug #65035 (yield / exit segfault). (Nikita) . Fixed bug #65161 (Generator + autoload + syntax error = segfault). (Nikita) . hex2bin() raises E_WARNING for invalid hex string. (Yasuo) + . Fixed bug #65226 (chroot() does not get enabled). (Anatol) - OPcache . Fixed bug #64827 (Segfault in zval_mark_grey (zend_gc.c)). (Laruence) From ed00dc8f822360cddeb52381776e36872c0a7c26 Mon Sep 17 00:00:00 2001 From: Yasuo Ohgaki Date: Thu, 11 Jul 2013 12:13:09 +0900 Subject: [PATCH 8/9] Inprove pg_unescape_bytea() error message --- ext/pgsql/pgsql.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ext/pgsql/pgsql.c b/ext/pgsql/pgsql.c index 1c78fffe55..128c2894f8 100644 --- a/ext/pgsql/pgsql.c +++ b/ext/pgsql/pgsql.c @@ -4212,7 +4212,7 @@ PHP_FUNCTION(pg_unescape_bytea) to = (char *)php_pgsql_unescape_bytea((unsigned char*)from, &to_len); #endif if (!to) { - php_error_docref(NULL TSRMLS_CC, E_WARNING,"Failed to unescape"); + php_error_docref(NULL TSRMLS_CC, E_WARNING,"Invalid parameter"); RETURN_FALSE; } RETVAL_STRINGL(to, to_len, 0); From 8679bffaca58cf03737ab6199a2ef3e8712b4ee2 Mon Sep 17 00:00:00 2001 From: Yasuo Ohgaki Date: Thu, 11 Jul 2013 12:23:11 +0900 Subject: [PATCH 9/9] Fixed meta data retrieve when OID is larger than 2^31 --- NEWS | 3 +++ ext/pdo_pgsql/pgsql_statement.c | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/NEWS b/NEWS index eef3c06873..2ad4288ffd 100644 --- a/NEWS +++ b/NEWS @@ -46,6 +46,9 @@ PHP NEWS . Allowed PDO_OCI to compile with Oracle Database 12c client libraries. (Chris Jones) +- PDO_pgsql: + . Fixed meta data retrieve when OID is larger than 2^31. (Yasuo) + - Phar: . Fixed Bug #65142 (Missing phar man page). (Remi) diff --git a/ext/pdo_pgsql/pgsql_statement.c b/ext/pdo_pgsql/pgsql_statement.c index d58eebf8f4..3ef89196de 100644 --- a/ext/pdo_pgsql/pgsql_statement.c +++ b/ext/pdo_pgsql/pgsql_statement.c @@ -587,7 +587,7 @@ static int pgsql_stmt_get_column_meta(pdo_stmt_t *stmt, long colno, zval *return add_assoc_long(return_value, "pgsql:oid", S->cols[colno].pgsql_type); /* Fetch metadata from Postgres system catalogue */ - spprintf(&q, 0, "SELECT TYPNAME FROM PG_TYPE WHERE OID=%d", S->cols[colno].pgsql_type); + spprintf(&q, 0, "SELECT TYPNAME FROM PG_TYPE WHERE OID=%u", S->cols[colno].pgsql_type); res = PQexec(S->H->server, q); efree(q);