com php-src: Fixed bug #72660 (NULL Pointer dereference in zend_virtual_cwd): NEWS ext/zip/php_zip.c ext /zip/tests/bug72660.phpt

From: Date: Sun, 24 Jul 2016 15:58:22 +0000
Subject: com php-src: Fixed bug #72660 (NULL Pointer dereference in zend_virtual_cwd): NEWS ext/zip/php_zip.c ext /zip/tests/bug72660.phpt
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-93368@lists.php.net to get a copy of this message
Commit: ad96a052d918c7fcfaab702c4319acac20435d6b Author: Xinchen Hui <laruence@gmail.com> Sun, 24 Jul 2016 23:58:22 +0800 Parents: da3995852edf1a5b7b4c8bda7a1e804cb263dc5e Branches: PHP-7.0 PHP-7.1 master Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=ad96a052d918c7fcfaab702c4319acac20435d6b Log: Fixed bug #72660 (NULL Pointer dereference in zend_virtual_cwd) Bugs: https://bugs.php.net/72660 Changed paths: M NEWS M ext/zip/php_zip.c A ext/zip/tests/bug72660.phpt Diff: diff --git a/NEWS b/NEWS index 5a01565..841af54 100644 --- a/NEWS +++ b/NEWS @@ -96,6 +96,10 @@ PHP NEWS - Wddx: . Fixed bug #72564 (boolean always deserialized as "true") (Remi) +- Zip: + . Fixed bug #72660 (NULL Pointer dereference in zend_virtual_cwd). + (Laruence) + 21 Jul 2016 PHP 7.0.9 - Core: diff --git a/ext/zip/php_zip.c b/ext/zip/php_zip.c index bdcba78...b9f0bb7 100644 --- a/ext/zip/php_zip.c +++ b/ext/zip/php_zip.c @@ -1619,10 +1619,10 @@ static void php_zip_add_from_pattern(INTERNAL_FUNCTION_PARAMETERS, int type) /* { struct zip *intern; zval *self = getThis(); - char *path = NULL; + char *path = "."; char *remove_path = NULL; char *add_path = NULL; - size_t add_path_len, remove_path_len = 0, path_len = 0; + size_t add_path_len, remove_path_len = 0, path_len = 1; zend_long remove_all_path = 0; zend_long flags = 0; zval *options = NULL; diff --git a/ext/zip/tests/bug72660.phpt b/ext/zip/tests/bug72660.phpt new file mode 100644 index 0000000..af02b9b --- /dev/null +++ b/ext/zip/tests/bug72660.phpt @@ -0,0 +1,20 @@ +--TEST-- +Bug #72660 (NULL Pointer dereference in zend_virtual_cwd) +--SKIPIF-- +<?php +if(!extension_loaded('zip')) die('skip'); +if(PHP_ZTS == 0) { die('skip ZTS required'); } +?> +--FILE-- +<?php +$zip = new ZipArchive(); +$zip->open(dirname(__FILE__) . "/bug72660.zip", ZIPARCHIVE::CREATE); +$zip->addPattern("/noexists/"); +?> +okey +--CLEAN-- +<?php +@unlink(dirname(__FILE__) . "/bug72660.zip"); +?> +--EXPECT-- +okey

« previous php.cvs (#93368) next »