Commit Graph

115123 Commits

Author SHA1 Message Date
Nikita Popov
7b7d99839c Fix symtable cache being used while cleaning symtable
We need to first clean the symtable and then check whether a cache
slot is available for it. Otherwise, it may happen that a destructor
runs while cleaning the table and uses up all the remaining slots
in the cache.

This is particularly insidious because once we overflow the cache,
the first pointer we modify is symtable_cache_ptr, making it hard
to understand what happened after the fact.

Fixes oss-fuzz #30815.
2021-02-15 14:58:38 +01:00
Daniel Black
3646604203 Fix #78680: mysqlnd pam plugin missing terminating null
The PAM service requires the terminating null to be part
of the communication.

Tested with MariaDB-10.4(pam) and Percona Server 5.7.32(auth_pam_compat).

Also changed MySQL Enterprise test to the server side plugin, authentication_pam
as opposed to the client plugin mysql_clear_password.

Add additional check for pamtest user and pam service file as
all are required for the test.

More importantly, test result should actually succeed.

Thanks Geoff Montee for bug report.

Closes GH-78680.
2021-02-15 11:32:07 +01:00
Nikita Popov
44a80b64b9 Fix leak when breaking out of FilesystemIterator
We need to always destroy current, not just when iter.data is not
set.

Take this opportunity to clean up the iterator destructor code a
bit, to remove redundant checks and incorrect comments.
2021-02-15 10:37:59 +01:00
Nikita Popov
c34c523467 Fixed bug #80719 2021-02-11 16:12:06 +01:00
Christoph M. Becker
4f508003a9 Avoid C4090 level 1 warning
This breaks the build for PHP 8 by default.
2021-02-08 23:11:37 +01:00
Christoph M. Becker
03713ace23 Fix locale dependent parsing of PostgreSQL version number
Version numbers are not supposed to be localized, so we must not apply
locale dependent parsing with `atof()`.

Using `php_version_compare()` might even be better.

Closes GH-6668.
2021-02-08 18:57:08 +01:00
Christoph M. Becker
ca7547c9e2 Fix #80706: mail(): Headers after Bcc headers may be ignored
We need to handle the case where a CRLF after a Bcc header is not the
beginning of a folding marker, because in that case the Bcc header was
not the last "thing".

Closes GH-6666.
2021-02-08 18:42:31 +01:00
Christoph M. Becker
4ff2665509 Use ST_Y() instead of the deprecated/removed Y() in test 2021-02-05 14:53:19 +01:00
Christoph M. Becker
3f8d21b922 Fix #74779: x() and y() truncating floats to integers
We must not use the locale dependent `atof()`, but instead use the
(hopefully) locale independent `zend_strtod()`, when converting string
representations of floating point numbers which are sent by the server.

Closes GH-6665.
2021-02-05 13:09:59 +01:00
Nikita Popov
8b7aaad7d6 Try SIGTERM before SIGKILL in opcache restart
SIGTERM is subject to HANDLE_BLOCK_INTERRUPTIONS(), which will
allow code to exit critical sections before it gets terminated.

Closes GH-6493.
2021-02-04 17:07:18 +01:00
Christoph M. Becker
958e3b93c3 [ci skip] Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix newly introduced compiler warning
2021-02-03 12:43:40 +01:00
Nikita Popov
06c9633b43 Fix newly introduced compiler warning
(cherry picked from commit ab8177de2c)
2021-02-03 12:42:28 +01:00
Christoph M. Becker
1bb2a4f91c Fix #53467: Phar cannot compress large archives
When Phars are flushed, a new temporary file is created for each entry
which should be compressed, and the `compressed_filesize` is retrieved.
Afterwards, the Phar manifest is written, and only after that the files
are copied to the actual Phar.  So for each such entry there is an open
temp file, what easily exceeds the limit.

Therefore, we use a single temporary file for all entries, and store
the start offset in the otherwise unused `header_offset` member.  We
ensure that the `cfp` members are properly set to NULL even if flushing
fails, to avoid use after free scenarios.

This solution is based on a suggestion by @lserni[1].

Closes GH-6643.

[1] <https://github.com/box-project/box2/issues/80#issuecomment-77147371>
2021-02-03 11:22:37 +01:00
Christoph M. Becker
3d09626f0d [ci skip] Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  7.3.28 is next
2021-02-02 17:07:16 +01:00
Christoph M. Becker
039ca4e219 7.3.28 is next 2021-02-02 17:01:55 +01:00
Peter Kokot
8c04944b66 Update year to 2021
Closes GH-6636.
2021-02-02 16:46:16 +01:00
Nikita Popov
54fa0a69f8 Add missing derefs in CurlFile
As pointed out on GH-6456.
2021-02-02 10:31:16 +01:00
Nikita Popov
51d76c346e Fix persistent leak on load_wsdl_ex failure
Move the load_wsdl_ex call into the zend_try that destroys the
docs hash table. The wsdl will be inserted into docs early on,
and will thus be released on subsequent bailout.
2021-02-02 10:05:35 +01:00
Christoph M. Becker
675a9b2831 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Revert "Updated to version 2021.1 (2021a)"
2021-02-01 13:42:43 +01:00
Christoph M. Becker
57257a4335 Revert "Updated to version 2021.1 (2021a)"
This reverts commit 491488d217, since
PHP-7.3 is in security mode, and this does not look security related.
2021-02-01 13:41:32 +01:00
Christoph M. Becker
7e9479083d Fix #80654: file_get_contents() maxlen fails above (2**31)-1 bytes
We remove the arbitrary restriction to `INT_MAX`; it is superfluous on
32bit systems where `ZEND_LONG_MAX == INT_MAX` anyway, and not useful
on 64bit systems, where larger files should be readable, if the
`memory_limit` is large enough.

Closes GH-6648.
2021-02-01 12:57:40 +01:00
Nikita Popov
217b9e7b41 Fix Laravel build on community job
Now requires PHP 7.4, so use php7.4 to run composer everywhere.
2021-02-01 09:48:14 +01:00
Nikita Popov
ab8177de2c Fix build 2021-02-01 09:46:17 +01:00
Stanislav Malyshev
86de4d7af6 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix bug #80672 - Null Dereference in SoapClient
2021-01-31 21:42:41 -08:00
Stanislav Malyshev
3c939e3f69 Fix bug #80672 - Null Dereference in SoapClient 2021-01-31 21:15:23 -08:00
Remi Collet
aeb4f21549 NEWS 2021-01-28 16:25:35 +01:00
Remi Collet
067f7e4150 Fix #80682 opcache doesn't honour pcre.jit option 2021-01-28 16:24:39 +01:00
Stanislav Malyshev
21f861225a Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Rm unneeded function
2021-01-27 00:15:13 -08:00
Stanislav Malyshev
9c673083cd Rm unneeded function 2021-01-27 00:13:43 -08:00
Stanislav Malyshev
fbf8c758fe Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Alternative fix for bug 77423
2021-01-26 22:55:10 -08:00
Christoph M. Becker
4a89e726bd Alternative fix for bug 77423
That bug report originally was about `parse_url()` misbehaving, but the
security aspect was actually only regarding `FILTER_VALIDATE_URL`.
Since the changes to `parse_url_ex()` apparently affect userland code
which is relying on the sloppy URL parsing[1], this alternative
restores the old parsing behavior, but ensures that the userinfo is
checked for correctness for `FILTER_VALIDATE_URL`.

[1] <5174de7cd3 (commitcomment-45967652)>
2021-01-26 22:54:58 -08:00
Christoph M. Becker
6a0b889f57 Fix #70091: Phar does not mark UTF-8 filenames in ZIP archives
The default encoding of filenames in a ZIP archive is IBM Code Page
437.  Phar, however, only supports UTF-8 filenames.  Therefore we have
to mark filenames as being stored in UTF-8 by setting the general
purpose bit 11 (the language encoding flag).

The effect of not setting this bit for non ASCII filenames can be seen
in popular tools like 7-Zip and UnZip, but not when extracting the
archives via ext/phar (which is agnostic to the filename encoding), or
via ext/zip (which guesses the encoding).  Thus we add a somewhat
brittle low-level test case.

Closes GH-6630.
2021-01-26 19:14:25 +01:00
Christoph M. Becker
94af11d5e1 Update version
That appears to have been forgotten for a while.
2021-01-26 19:08:23 +01:00
Christoph M. Becker
61ed904cec Fix #75850: Unclear error message wrt. __halt_compiler() w/o semicolon
We add the failure reason to the error message.

Closes GH-6638.
2021-01-25 18:47:15 +01:00
Derick Rethans
3f183bbcf8 Updated to version 2021.1 (2021a) 2021-01-25 10:44:05 +00:00
Derick Rethans
072cfef1d5 Empty merge 2021-01-25 10:44:05 +00:00
Derick Rethans
491488d217 Updated to version 2021.1 (2021a) 2021-01-25 10:44:04 +00:00
Christoph M. Becker
edb389730d Add missing SKIPIF clause for recently introduced test case 2021-01-21 17:27:09 +01:00
Christoph M. Becker
6adfb8c962 Fix #80648: Fix for bug 79296 should be based on runtime version
Instead of checking for actually affected libzip versions, we now always
`ZIP_TRUNCATE` empty files unless `ZIP_RDONLY` is set.

Closes GH-6625.
2021-01-20 16:20:13 +01:00
Christoph M. Becker
4c1b3e3036 Add missing SKIPIF clauses to new test cases 2021-01-20 11:02:52 +01:00
Derick Rethans
a33d0c3aae Update NEWS and version 2021-01-19 14:58:38 +00:00
Derick Rethans
e8a89c49db Update NEWS for PHP 7.4.15RC1 2021-01-19 14:44:32 +00:00
sj-i
5d31ee302d Fixed bug #42560
Check open_basedir after the fallback to the system's temporary
directory in tempnam().

In order to preserve the current behavior of upload_tmp_dir
(do not check explicitly specified dir, but check fallback),
new flags are added to check open_basedir for explicit dir
and for fallback.

Closes GH-6526.
2021-01-19 11:41:58 +01:00
Christoph M. Becker
68f5289e9e Fix #69279: Compressed ZIP Phar extractTo() creates garbage files
When extracting compressed files from an uncompressed Phar, we must not
use the direct file pointer, but rather get an uncompressed file
pointer.

We also add a test to show that deflated and stored entries are
properly extracted.

This also fixes #79912, which appears to be a duplicate of #69279.

Co-authored-by: Anna Filina <afilina@gmail.com>

Closes GH-6599.
2021-01-19 10:28:54 +01:00
Christoph M. Becker
38ad37ad43 Fix #80595: Resetting POSTFIELDS to empty array breaks request
This is mainly to work around https://github.com/curl/curl/issues/6455,
but not building the mime structure for empty hashtables is a general
performance optimization, so we do not restrict it to affected cURL
versions (7.56.0 to 7.75.0).

The minor change to bug79033.phpt is unexpected, but should not matter
in practice.

Closes GH-6606.
2021-01-18 10:57:56 +01:00
Christoph M. Becker
25103c37aa Revert "Fix #76813: Access violation near NULL on source operand"
This reverts commit 5e15c9c41f, since
re2c default rules are only available as of re2c 0.13.7.
2021-01-11 13:21:12 +01:00
Christoph M. Becker
9450893dc6 Avoid modifying the return value of readline_completion_function()
The internal function `_readline_command_generator()` modifies the
internal array pointer of `readline_completion_function()`'s return
value.  We therefore separate the array, what also avoids failing
assertions regarding the array refcount.

Closes GH-6582.
2021-01-07 13:46:09 +01:00
Christoph M. Becker
d1b1c04398 Fix #77565: Incorrect locator detection in ZIP-based phars
We must not assume that the first end of central dir signature in a ZIP
archive actually designates the end of central directory record, since
the data in the archive may contain arbitrary byte patterns.  Thus, we
better search from the end of the data, what is also slightly more
efficient.

There is, however, no way to detect the end of central directory
signature by searching from the end of the ZIP archive with absolute
certainty, since the signature could be part of the trailing comment.
To mitigate, we check that the comment length fits to the found
position, but that might still not be the correct position in rare
cases.

Closes GH-6507.
2021-01-05 23:40:24 +01:00
Christoph M. Becker
5c963731e2 Fix memory leak in Phar::webPhar() on Windows
Closes GH-6574.
2021-01-05 14:21:35 +01:00
Dylan K. Taylor
6b631f073d gdbinit: use ____print_str to print htable keys
I noticed this problem while dumping the contents of EG(function_table),
where keys for closures start with a null byte. printf interprets this
as a zero-length string and emits nothing. This allows the key to be
rendered properly in readable form.

Closes GH-6577.
2021-01-05 10:11:56 +01:00