php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #79424 php_zip_glob uses gl_pathc after call to globfree
Submitted: 2020-03-28 07:58 UTC Modified: -
From: maxcrees at me dot com Assigned:
Status: Closed Package: Zip Related
PHP Version: 7.3Git-2020-03-28 (Git) OS: Linux/musl
Private report: No CVE-ID: None
 [2020-03-28 07:58 UTC] 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


Patches

Add a Patch

Pull Requests

Pull requests:

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2020-03-28 08:14 UTC] maxcrees at me dot com
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
 [2020-03-29 12:24 UTC] remi@php.net
Automatic comment on behalf of maxcrees@me.com
Revision: http://git.php.net/?p=php-src.git;a=commit;h=04920645f14ea117d5248ef3a0e03c6784c2fb49
Log: Fix #79424 ext/zip: don't use gl_pathc after call to globfree
 [2020-03-29 12:24 UTC] remi@php.net
-Status: Open +Status: Closed
 
PHP Copyright © 2001-2020 The PHP Group
All rights reserved.
Last updated: Fri Jul 10 14:01:25 2020 UTC