Bug #79424 [PATCH]: php_zip_glob uses gl_pathc after call to globfree

From: Date: Sat, 28 Mar 2020 08:14:25 +0000
Subject: Bug #79424 [PATCH]: php_zip_glob uses gl_pathc after call to globfree
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-226291@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=79424&edit=1 ID: 79424 Patch added by: maxcrees@me.com Reported by: maxcrees at me dot com Summary: php_zip_glob uses gl_pathc after call to globfree Status: Open Type: Bug Package: Zip Related Operating System: Linux/musl PHP Version: 7.3Git-2020-03-28 (Git) Block user comment: N Private report: N New Comment: The following pull request has been associated: Patch Name: ext/zip: don't use gl_pathc after call to globfree (#79424) On GitHub: https://github.com/php/php-src/pull/5311 Patch: https://github.com/php/php-src/pull/5311.patch Previous Comments: ------------------------------------------------------------------------ [2020-03-28 07:58:46] maxcrees at me dot com Description: ------------ On Linux with the musl libc, globfree zeroes out the gl_pathc field of the given glob_t struct[1]. This breaks the behavior of php_zip_glob (as used by ZipArchive::addGlob) since it calls globfree immediately before using the gl_pathc field of the struct as its return value. This is addressed by PR #5311. It affects all currently maintained branches of PHP (I believe 7.3, 7.4, and master, since 7.2 is "orange"). It was discovered indirectly by the existing tests ext/zip/tests/bug70103.phpt and ext/zip/tests/bug78641.phpt which resulted in ENOENT upon ZipArchive::close since no entries were added to the archive (gl_pathc == 0). [1] http://git.musl-libc.org/cgit/musl/tree/src/regex/glob.c#n306 ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=79424&edit=1

« previous php.bugs (#226291) next »