1
0
mirror of https://github.com/php/php-src.git synced 2026-04-21 15:08:16 +02:00
Commit Graph

1183 Commits

Author SHA1 Message Date
Christoph M. Becker b01b1f65e7 Fix # 79171: heap-buffer-overflow in phar_extract_file
We must not access memory outside of the allocated buffer.
2020-02-17 00:20:17 -08:00
Stanislav Malyshev bbcb8cab8c Fix bug #79082 - Files added to tar with Phar::buildFromIterator have all-access permissions 2020-02-17 00:20:17 -08:00
Nikita Popov 58b17906f5 Apply tidy formatting
Mostly reindent PHP scripts to spaces.
2020-02-03 13:41:31 +01:00
Christoph M. Becker e197f65b35 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix #76584: PharFileInfo::decompress not working
2020-01-28 10:33:10 +01:00
Christoph M. Becker 136f51f1e1 Fix #76584: PharFileInfo::decompress not working
We actually have to decompress, when told to do so.
2020-01-28 10:31:36 +01:00
Dmitry Stogov 92c23e1fd3 Call zend_unregister_ini_entries() when unload extension loaded through dl() without MSHUTDOWN callback.
Extensions with MSHUTDOWN should use UNREGISTER_INI_ENTRIES().
2019-12-09 15:05:24 +03:00
Sara Golemon 15d7cd9e18 Silence undefined index warning when openssl not available. 2019-10-15 15:37:56 -04:00
Nikita Popov e4aac082a2 Merge branch 'PHP-7.3' into PHP-7.4 2019-10-10 16:14:52 +02:00
Nikita Popov 74ac3dd6e2 Merge branch 'PHP-7.2' into PHP-7.3 2019-10-10 16:14:37 +02:00
Nikita Popov 46561dab6a Fix leak in phar open 2019-10-10 16:14:21 +02:00
Stanislav Malyshev 4adf3dc109 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix #77919: Potential UAF in Phar RSHUTDOWN
  Update NEWS
  Fix bug #78256 (heap-buffer-overflow on exif_process_user_comment)
  Fix bug #78222 (heap-buffer-overflow on exif_scan_thumbnail)
2019-07-29 13:20:52 -07:00
Stanislav Malyshev d69894734d Merge branch 'PHP-7.2' into PHP-7.3
* PHP-7.2:
  Fix #77919: Potential UAF in Phar RSHUTDOWN
  Update NEWS
  Fix bug #78256 (heap-buffer-overflow on exif_process_user_comment)
  Fix bug #78222 (heap-buffer-overflow on exif_scan_thumbnail)
2019-07-29 13:20:44 -07:00
Stanislav Malyshev 284fb08fdc Merge branch 'PHP-7.1' into PHP-7.2
* PHP-7.1:
  Fix #77919: Potential UAF in Phar RSHUTDOWN
  Update NEWS
  Fix bug #78256 (heap-buffer-overflow on exif_process_user_comment)
  Fix bug #78222 (heap-buffer-overflow on exif_scan_thumbnail)
2019-07-29 13:19:16 -07:00
Christoph M. Becker cd1101e8c8 Fix #77919: Potential UAF in Phar RSHUTDOWN
We have to properly clean up in case phar_flush() is failing.

We also make the expectation of the respective test case less liberal
to avoid missing such bugs in the future.
2019-07-29 13:18:27 -07:00
Remi Collet 946a1e4314 Fix build warnings
- switch from strncpy to memcpy for -Wstringop-truncation
2019-07-25 11:50:44 +02:00
Nikita Popov d9680272c7 Revert "Drop free_filename field from zend_file_handle"
This reverts commit e0eca26285.

free_filename is used by the wincache extension, restore this
field for PHP 7.4.
2019-07-24 10:43:37 +02:00
George Peter Banyard 6d6d954d0d Cleanup of remaining E_STRICT in tests 2019-07-23 11:27:23 +02:00
Nikita Popov 5664035ffe Also report errors from Zend stream reader operation 2019-07-22 17:49:08 +02:00
Nikita Popov d59aac58b3 Report errors from stream read and write operations
The php_stream_read() and php_stream_write() functions now return
an ssize_t value, with negative results indicating failure. Functions
like fread() and fwrite() will return false in that case.

As a special case, EWOULDBLOCK and EAGAIN on non-blocking streams
should not be regarded as error conditions, and be reported as
successful zero-length reads/writes instead. The handling of EINTR
remains unclear and is internally inconsistent (e.g. some code-paths
will automatically retry on EINTR, while some won't).

I'm landing this now to make sure the stream wrapper ops API changes
make it into 7.4 -- however, if the user-facing changes turn out to
be problematic we have the option of clamping negative returns to
zero in php_stream_read() and php_stream_write() to restore the
old behavior in a relatively non-intrusive manner.
2019-07-22 17:17:28 +02:00
Peter Kokot b1643e166d Fix failed tests for phar
- when $status is boolean, E_NOTICE appears and tests fail
- opcache is never enabled on these tests anyway.
- Add opcache.revalidate_freq=0 to testing script

  Instead of checking this in the tests files it can be used directly in
  the main testing script. Also this fixes failed tests.

- Use opcache_invalidate() instead of sleep() delay in some tests. Some
  delays are still used since the opcache_invalidate seems to be buggy
  and not working as expected.

Closes GH-4392
2019-07-21 00:49:35 +02:00
Peter Kokot 7cbc6b6546 Remove safe_mode directive when installing ext/phar
Closes GH-4436
2019-07-19 00:02:12 +02:00
Nikita Popov 856c5d2837 Revert "Avoid unused fstat() call"
This reverts commit 5a90dc77b8.

Let's try to go with the reverse direction here and actually trust
the reported size...
2019-07-17 11:49:10 +02:00
Nikita Popov 5a90dc77b8 Avoid unused fstat() call
If we're including a file via PHP streams, we're not going to trust
the reported file size anyway and populate in a loop -- so don't
bother determining the file size in the first place. Only do this
for non-tty HANDLE_FP now, which is the only case where this
information was used.
2019-07-17 11:22:31 +02:00
Nikita Popov b317f0eb59 Remove ZEND_HANDLE_MAPPED
The buf/len members are now simply used in addition to the main
stream, without changing the handle kind.
2019-07-16 17:44:32 +02:00
Nikita Popov e0eca26285 Drop free_filename field from zend_file_handle
free_filename was always zero.
2019-07-16 17:07:26 +02:00
Nikita Popov 49bac9b77b Introduce zend_stream_init_filename()
Avoid more ad-hoc initialization of zend_file_handle structures.
2019-07-16 16:44:37 +02:00
Nikita Popov e08cc4d921 Remove ZEND_HANDLE_FD
This handle type was unused.
2019-07-16 15:47:10 +02:00
Nikita Popov 290e520c03 Use ZEND_HASH_FOREACH APIs in a few more places 2019-07-16 12:20:16 +02:00
Nikita Popov 709897c2a5 Remove unused tsrm_strtok_r() function
There is also a php_strtok_r() function, which is actually used,
but nothing uses the tsrm_strtok_r() variant...
2019-07-12 13:14:24 +02:00
Nikita Popov 07bbc54658 Fix file collisions in phar tests 2019-07-10 12:55:40 +02:00
Peter Kokot 839ff378bc Fix phar tests with hash extension
- The hash extension is now always available.

- Remove unfinished test
  The Phar::PGP currently doesn't exist yet.
2019-06-30 23:51:56 +02:00
Peter Kokot 033cafacbd Sync HAVE_HASH, HAVE_HASH_EXT, PHAR_HASH_OK symbols
The hash extension is always available since PHP-7.4. The symbol
HAVE_HASH_EXT is kept for BC reasons and removed in PHP-8.0.

This patch also removes the PHAR_HASH_OK since it is no longer
relevant.
2019-06-27 23:25:33 +02:00
Nikita Popov c7962207d7 Fix stream leak in phar cache_list 2019-06-25 14:28:58 +02:00
Nikita Popov 43dd1ac570 Avoid confusing gotos in phar_split_cache_list 2019-06-25 10:25:44 +02:00
Nikita Popov 31123de0c8 Fix EVP_PKEY leak in phar 2019-06-25 10:25:44 +02:00
Nikita Popov c10cb47b5f Fix uninitialized variable
I mistakenly moved len1 initialization into the conditional as well.
2019-06-19 15:34:51 +02:00
Nikita Popov b1196e2128 Phar: Avoid negative zip dates
The zip date/time encoding format is incredibly stupid.
2019-06-19 15:09:00 +02:00
Nikita Popov 7bf6326259 Fix memcpy null UB in phar 2019-06-19 15:09:00 +02:00
Joe Watkins 2283884475 this mtime comparison makes assumptions that cannot always hold true 2019-06-16 08:29:04 +02:00
Christoph M. Becker 15b394cce9 Prevent test conflicts 2019-05-14 10:11:29 +02:00
Peter Kokot 75fb74860d Normalize comments in *nix build system m4 files
Normalization include:
- Use dnl for everything that can be ommitted when configure is built in
  favor of the shell comment character # which is visible in the output.
- Line length normalized to 80 columns
- Dots for most of the one line sentences
- Macro definitions include similar pattern header comments now
2019-05-12 18:43:03 +02:00
peter279k ba0913a2e5 Fix undefined variable, and remove unused test-pdo 2019-05-03 18:14:32 +02:00
Christoph M. Becker be74a00464 Fix VirtualProtect() related Phar issues
We must not (try to) modify shared values, but rather have to use our
own copies, if unixified filenames are required on Windows.  To avoid
excessive string duplication, we add checks whether the filenames are
already unixified (i.e. do not contain backslashes).  To improve the
performance if we need to copy strings, we use do_alloca() and friends.

Besides generally being somewhat messy, the handling of unixified
filenames is still suboptimal performance-wise, but we leave this for a
future cleanup, and focus on fixing the issue at hand for now.

We also enable opcache.protect_memory for the AppVeyor CI.
2019-04-26 09:09:22 +02:00
Christoph M. Becker 346ac968b3 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix tests for non English environments
2019-04-17 09:58:12 +02:00
Christoph M. Becker ec8457d982 Merge branch 'PHP-7.2' into PHP-7.3
* PHP-7.2:
  Fix tests for non English environments
2019-04-17 09:57:37 +02:00
Christoph M. Becker 6fe75f9e45 Fix tests for non English environments 2019-04-17 09:56:55 +02:00
Anatol Belski db7aba538d Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix phar:// include handling with file cache
2019-04-10 14:57:04 +02:00
Anatol Belski 1aa30bb71c Merge branch 'PHP-7.2' into PHP-7.3
* PHP-7.2:
  Fix phar:// include handling with file cache
2019-04-10 14:56:29 +02:00
Anatol Belski f31d7ca85e Fix phar:// include handling with file cache 2019-04-10 14:55:15 +02:00
Fabien Villepinte 26dfce7f36 Replace dirname(__FILE__) by __DIR__ in tests 2019-03-15 22:55:30 +01:00