Commit graph

130299 commits

Author SHA1 Message Date
Pierrick Charron
38bd305473
Update NEWS 2023-02-13 11:07:53 -05:00
Niels Dossche
0f2957f3ec
Fix array overrun when appending slash to paths
Fix it by extending the array sizes by one character. As the input is
limited to the maximum path length, there will always be place to append
the slash. As the php_check_specific_open_basedir() simply uses the
strings to compare against each other, no new failures related to too
long paths are introduced.
We'll let the DOM and XML case handle a potentially too long path in the
library code.
2023-02-13 11:02:47 -05:00
Tim Düsterhus
86d0d1b0d9
crypt: Fix possible buffer overread in php_crypt() 2023-02-13 11:02:36 -05:00
Tim Düsterhus
e2e6c577a7
crypt: Fix validation of malformed BCrypt hashes
PHP’s implementation of crypt_blowfish differs from the upstream Openwall
version by adding a “PHP Hack”, which allows one to cut short the BCrypt salt
by including a `$` character within the characters that represent the salt.

Hashes that are affected by the “PHP Hack” may erroneously validate any
password as valid when used with `password_verify` and when comparing the
return value of `crypt()` against the input.

The PHP Hack exists since the first version of PHP’s own crypt_blowfish
implementation that was added in 1e820eca02.

No clear reason is given for the PHP Hack’s existence. This commit removes it,
because BCrypt hashes containing a `$` character in their salt are not valid
BCrypt hashes.
2023-02-13 11:01:58 -05:00
Jakub Zelenka
95b33b624c
Introduce max_multipart_body_parts INI
This fixes GHSA-54hq-v5wp-fqgv DOS vulnerabality by limitting number of
parsed multipart body parts as currently all parts were always parsed.
2023-02-10 11:13:28 +00:00
Jakub Zelenka
89a20c2ccb
Fix repeated warning for file uploads limit exceeding 2023-02-10 11:07:17 +00:00
Pierrick Charron
1793f8dada
Prepare 8.2.3 branch 2023-02-05 14:19:24 -05:00
Arnaud Le Blanc
36d55f8918
Handle non-INDIRECT symbol table entries in zend_fiber_object_gc() (#10386)
Fixes GH-10340
2023-01-27 20:26:58 +03:00
Patrick Allaert
1ceb2f3313
Merge branch 'PHP-8.1' into PHP-8.2 2023-01-17 17:24:53 +01:00
Patrick Allaert
c47a1a260d
PHP-8.1 is now for PHP 8.1.16-dev 2023-01-17 17:24:25 +01:00
George Peter Banyard
dd5c5ca7a5
Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Handle exceptions from __toString in XXH3's initialization
  Fix phpdbg segmentation fault in case of malformed input
2023-01-17 14:16:18 +00:00
Niels Dossche
7463e70b1e
Handle exceptions from __toString in XXH3's initialization
The initialization routine for XXH3 was not prepared for exceptions from seed.
Fix this by using try_convert_to_string.

For discussion, please see: GH-10305

Closes GH-10352

Signed-off-by: George Peter Banyard <girgias@php.net>
2023-01-17 14:14:12 +00:00
Niels Dossche
398a10a58a
Fix phpdbg segmentation fault in case of malformed input
If you were to enter "w $>" the function would crash with a segmentation
fault because last_index is still NULL at that point. Fix it by checking
for NULL and erroring out if it is.

Closes GH-10353

Signed-off-by: George Peter Banyard <girgias@php.net>
2023-01-17 14:12:49 +00:00
Bob Weinand
a6a20c9e17 Add regression test for e560592a61
Reproduces only under ASAN.

Signed-off-by: Bob Weinand <bobwei9@hotmail.com>
2023-01-17 11:14:00 +01:00
David Carlier
385f410e4c Merge branch 'PHP-8.1' into PHP-8.2 2023-01-16 20:43:08 +00:00
Niels Dossche
dfe9c2af19 Fix incorrect comparison in block optimization pass
We're in the case of ZEND_JMPZ_EX or ZEND_JMPNZ_EX. The opcode gets
overwritten and only after the overwriting gets checked if we're in a
JMPZ or JMPNZ case. This results in a wrong optimization.

Close GH-10329
2023-01-16 20:41:33 +00:00
Petar Obradović
e560592a61 Fix GH-9675: Re-adjust run_time_cache init for internal enum methods
Closes GH-10143.
2023-01-16 17:38:38 +01:00
Dmitry Stogov
757e269b89 Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Fix GH-10271: Incorrect arithmetic calculations when using JIT
2023-01-16 14:51:42 +03:00
Dmitry Stogov
42eed7bb4e Fix GH-10271: Incorrect arithmetic calculations when using JIT 2023-01-16 14:51:26 +03:00
Dmitry Stogov
4d8f409bfc Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Revert "Merge branch 'PHP-8.0' into PHP-8.1"
2023-01-16 11:18:15 +03:00
Dmitry Stogov
0d011e4626 Revert "Merge branch 'PHP-8.0' into PHP-8.1"
This reverts commit 0116864cd3, reversing
changes made to 1f715f5658.
2023-01-16 11:15:30 +03:00
George Peter Banyard
ec377c687d
Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Fix wrong flags check for compression method in phar_object.c
  Fix missing check for xmlTextWriterEndElement
  Fix substr_replace with slots in repl_ht being UNDEF
2023-01-15 15:43:34 +00:00
Niels Dossche
347b7c3628
Fix wrong flags check for compression method in phar_object.c
I found this issue using static analysis tools, it reported that the condition was always false.
We can see that flags is assigned in the switch statement above, but a mistake was made in the comparison.

Closes GH-10328

Signed-off-by: George Peter Banyard <girgias@php.net>
2023-01-15 15:35:35 +00:00
Niels Dossche
11a1feb0d7
Fix missing check for xmlTextWriterEndElement
xmlTextWriterEndElement returns -1 if the call fails. There was already
a check for retval, but the return value wasn't assigned to retval. The
other caller of xmlTextWriterEndElement is in
xmlwriter_write_element_ns, which does the check correctly.

Closes GH-10324

Signed-off-by: George Peter Banyard <girgias@php.net>
2023-01-15 15:34:43 +00:00
Niels Dossche
4bbbe6d652
Fix substr_replace with slots in repl_ht being UNDEF
The check that was supposed to check whether the array slot was UNDEF
was wrong and never triggered. This resulted in a replacement with the
empty string or the wrong string instead of the correct one. The correct
check pattern can be observed higher up in the function's code.

Closes GH-10323

Signed-off-by: George Peter Banyard <girgias@php.net>
2023-01-15 15:31:34 +00:00
Jakub Zelenka
d0dd77a3c2
Merge branch 'PHP-8.1' into PHP-8.2 2023-01-14 15:14:44 +00:00
Jakub Zelenka
7d98e3e40c
Fix missing comment in FPM www.conf.in 2023-01-14 15:13:55 +00:00
Arnaud Le Blanc
61048f984a Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Fix run-tests.php hanging when a worker process dies without notice (#9931)
2023-01-13 18:07:45 +01:00
Arnaud Le Blanc
8c0698f66b
Fix run-tests.php hanging when a worker process dies without notice (#9931)
run-tests.php with `-jN` can hang if a parallel worker dies without notice. This
can happen due to fatal errors in the worker, or if the worker is killed.

- run-tests.php (main process)
  \_ run-tests.php (worker #0) // main process hangs if this one crashes
     \_ test-001.php (test-001.phpt)
2023-01-13 17:43:17 +01:00
Arnaud Le Blanc
871d9f2d70 [ci skip] NEWS 2023-01-13 12:29:51 +01:00
Arnaud Le Blanc
d89408075f Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Reduce HT_MAX_SIZE to account for the max load factor of 0.5 (#10242)
  GC fiber unfinished executions (#9810)
2023-01-13 12:28:21 +01:00
Arnaud Le Blanc
0f7625c47c
Reduce HT_MAX_SIZE to account for the max load factor of 0.5 (#10242)
zend_hash allocates a hash table twice as big as nTableSize
(HT_HASH_SIZE(HT_SIZE_TO_MASK(nTableSize)) == nTableSize*2), so HT_MAX_SIZE
must be half the max table size or less.

Fixes GH-10240
2023-01-13 12:05:51 +01:00
Arnaud Le Blanc
4fb149390a
GC fiber unfinished executions (#9810) 2023-01-13 12:04:28 +01:00
Jakub Zelenka
a8c387e89c
Merge branch 'PHP-8.1' into PHP-8.2 2023-01-13 10:32:52 +00:00
Jakub Zelenka
120aafcc42
Fix bug #67244: Wrong owner:group for listening unix socket
Update FPM www.conf to reflect the actual logic
2023-01-13 10:31:01 +00:00
Tim Düsterhus
fd7214436a
Fix comment for php_safe_bcmp (#10306)
* main: Fix comment for php_safe_bcmp

* main: Include note about php_safe_bcmp being security sensitive

This is taken from the implementation of `hash_equals()`.
2023-01-12 23:30:36 +01:00
David Carlier
884e8a970a Merge branch 'PHP-8.1' into PHP-8.2 2023-01-12 22:01:30 +00:00
Niels Dossche
833b45ac44 Fix GH-10249: Assertion `size >= page_size + 1 * page_size' failed.
Co-authored-by: Changochen <changochen1@gmail.com>

Closes GH-10284
2023-01-12 22:00:00 +00:00
Tim Düsterhus
8c7aacd760
Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Revert "Make build work with newer OpenSSL"
  [ci skip] Next release will be 8.0.28
  [ci skip] Prepare for PHP 8.0.27 GA
2023-01-12 21:52:48 +01:00
Tim Düsterhus
0116864cd3
Merge branch 'PHP-8.0' into PHP-8.1
* PHP-8.0:
  Revert "Make build work with newer OpenSSL"
  [ci skip] Next release will be 8.0.28
  [ci skip] Prepare for PHP 8.0.27 GA
2023-01-12 21:48:23 +01:00
Tim Düsterhus
f2e8c5da90
unserialize: Strictly check for :{ at object start (#10214)
* unserialize: Strictly check for `:{` at object start

* unserialize: Update CVE tests

It's unlikely that the object syntax error contributed to the actual CVE. The
CVE is rather caused by the incorrect object serialization data of the `C`
format. Add a second string without such a syntax error to ensure that path is
still executed as well to ensure the CVE is absent.

* Fix test expectation in gmp/tests/bug74670.phpt

No changes to the input required, because the test actually is intended to
verify the behavior for a missing `}`, it's just that the report position changed.

* NEWS

* UPGRADING
2023-01-12 19:55:54 +01:00
George Peter Banyard
31fd34aa4c
Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Use absolute paths in OPCache tests when calling `opcache_compile_file()`
2023-01-12 15:48:01 +00:00
Thomas Gerbet
1f715f5658
Use absolute paths in OPCache tests when calling opcache_compile_file()
This make sure the tests do not fail if they are not run from the
repository root.

Closes GH-10266

Signed-off-by: George Peter Banyard <girgias@php.net>
2023-01-12 15:47:24 +00:00
Jakub Zelenka
1b48a5c802
Fix ASAN reported leak in FPM config test
This happens because config test does not shutdown SAPI.

In addition this commit also fixes few failures when running FPM tests
under root.

Closes GH-10296
2023-01-12 13:52:33 +00:00
George Peter Banyard
c936c02119
Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  fix: indirect_return compilation warning
2023-01-10 15:23:35 +00:00
Kévin Dunglas
55514a1119
fix: indirect_return compilation warning
Closes GH-10274

Signed-off-by: George Peter Banyard <girgias@php.net>
2023-01-10 15:23:15 +00:00
Derick Rethans
f340854a30 Merge branch 'PHP-8.1' into PHP-8.2 2023-01-10 15:16:32 +00:00
Derick Rethans
d12ba111e0 Fixed GH-10218: DateTimeZone fails to parse time zones that contain the "+" character 2023-01-10 15:15:49 +00:00
Christoph M. Becker
435dc5ef1c
Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Adapt ext/intl tests for ICU 72.1
2023-01-09 14:09:43 +01:00
Christoph M. Becker
a9e7b90cc2
Adapt ext/intl tests for ICU 72.1
This version replaces SPACEs before the meridian with NARROW NO-BREAK
SPACEs.  Thus, we split the affected test cases as usual.

(cherry picked from commit 8dd51b462d)

Fixes GH-10262.
2023-01-09 14:08:40 +01:00