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

122742 Commits

Author SHA1 Message Date
Dmitry Stogov
2e02b1f157 JIT: Call zend_hash_index_find() instead of _zend_hash_index_find() if we didn't check for packed array before 2021-09-27 23:16:47 +03:00
Dmitry Stogov
325865d750 JIT: Split zend_jit_hash_index_lookup_rw() into zend_jit_hash_index_lookup_rw() and zend_jit_hash_index_lookup_rw_no_packed().
The previous version might fail if zend_jit_hash_index_lookup_rw() was called for packed array.
2021-09-27 22:09:51 +03:00
Dmitry Stogov
9ce388b41b JIT: Fixed missed zval type initialization 2021-09-27 20:05:50 +03:00
Nikita Popov
7d483418e2 Fix relative offsets when copying JMPZNZ
This was doing a plain copy of JMPZNZ, even though it encodes
offsets relative to the opline. As such, the offsets would be
relative to target, while they should be relative to opline.
Fix this by recomputing them.

Fixes oss-fuzz #39295.
2021-09-27 16:18:40 +02:00
Nikita Popov
823888c472 Start block at loop var free
This ensures that code directly before the loop var free is
separated out (and will generally be eliminated as unreachable).
This fixes some assumptions we have that unreachable loop var free
blocks start with the loop var free.

Fixes oss-fuzz #39395.
2021-09-27 11:56:37 +02:00
Nikita Popov
ddf8910237 Fix DCE of unreachable phi in cycle
We can't remove a trivial phi of the form x = phi(x), because we
don't have a replacement value. We could drop the whole block
though. SCCP would normally do this, but in this particular case
we only determine non-reachability based on type information.

Fixes oss-fuzz #39316.
2021-09-27 11:26:31 +02:00
Nikita Popov
038bc27787 Handle pi nodes in replace_predecessor
If we're removing a predecessor because it already exists during
replacement, we should also drop pi nodes for that predecessor.

Fixes oss-fuzz #39276.
2021-09-27 10:47:47 +02:00
Nikita Popov
3adbafeef7 Fix leak when iterating uninitialized RecursiveIteratorIterator 2021-09-24 13:17:34 +02:00
Lin Yang
9ad8fadcbb Fix bug #81472: Support large device major/minor number
Latest linux kernel use large number (12 bits for major device, 20
bits for minor device). Current code only supports previous standard
(5 chars), which means 8 bits for major and 8 bits for minor device.
It will fail if device number is out of that range. So this patch
increases device number read from /proc/self/maps file.

Closes GH-7512.
2021-09-24 09:57:32 +02:00
Christoph M. Becker
c0dcd141a8 Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Fix gdAlphaMax limit typo
2021-09-23 23:18:52 +02:00
Michael Voříšek
2c3dfe5160 Fix gdAlphaMax limit typo
Closes GH-7410.
2021-09-23 23:16:40 +02:00
Dmitry Stogov
3e6919cfb3 Tracing JIT: Fixed possible incorrect megamorphic call from a trait 2021-09-23 23:38:03 +03:00
Nikita Popov
be8217368b Bail on exception during delayed autoload
We shouldn't try to load further classes if one autoload throws.

This fixes oss-fuzz #38881, though I believe there are still two
deeper issues here: 1) Why do we allow autoloading with an active
exception? 2) Exception save & restore should probably also save
and restore the exception opline.
2021-09-23 12:46:39 +02:00
Dmitry Stogov
430454268f Tracing JIT: Remove incorrect assertion 2021-09-23 12:14:33 +03:00
Dmitry Stogov
08100e81e5 Tracing JIT: Fixed possible stack-buffer-overflow. 2021-09-23 10:51:20 +03:00
Dmitry Stogov
17a99f2b11 Check for zend_shared_alloc() failures 2021-09-23 01:00:50 +03:00
Dmitry Stogov
09d4037a17 JIT: Fixed possible memory leak 2021-09-22 22:57:57 +03:00
Nikita Popov
983a4fc4a3 Fix ASSIGN_STATIC_PROP_REF type inference
We were not inferring anything for the ASSIGN_STATIC_PROP_REF
result type at all, leaving it as an empty type. In the test
case this results in a live range being incorrectly eliminated,
but this could break in all kinds of other ways as well..
2021-09-22 15:55:25 +02:00
Nikita Popov
770879702a Fix JIT typed property inc/dec
This was leaking memory for pre-inc/dec of a refcounted typed
property if the result was not used.

The code to do this was unnecessarily complicated, we can base
this on the zend_jit_inc/dec_typed_prop() helper and copy to the
result afterwards.
2021-09-22 15:32:19 +02:00
Dmitry Stogov
e588f24276 Fixed type inference 2021-09-22 15:30:30 +03:00
Dmitry Stogov
7a93a8a6fd JIT: Fixed JIT for FETCH_OBJ when op1 is a reference of non-object 2021-09-22 14:52:25 +03:00
Dmitry Stogov
19854371ed Tracing JIT: Fixed bug in register allocator.
Type of variable might need to be checked (using type guard) before loading to register.
2021-09-22 00:43:56 +03:00
Nikita Popov
61445248cb Don't unconditionally add array value type for undef
We have an invariant that an array value type is set if and only
if an array key type is set, which is violated for the case of
undef values for always invalid keys.
2021-09-21 14:54:16 +02:00
Nikita Popov
f4bcf8c393 Check for undef var in typed property assignment
Without this check the assignment would actually silently succeed,
not just skip the warning.
2021-09-21 14:09:26 +02:00
Dmitry Stogov
48d050ef72 JIT: Disable recursive call optimization for VM without global register variables
A tail-call to VM handler from recursively called function may lead to
pass control to incorrect stack frame.
2021-09-21 14:30:56 +03:00
Christoph M. Becker
051036330a [ci skip] Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  7.3.32 is next
2021-09-21 13:20:43 +02:00
Christoph M. Becker
f70aae28a9 [ci skip] Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  7.3.32 is next
2021-09-21 13:19:42 +02:00
Christoph M. Becker
f2f40b1cf7 7.3.32 is next 2021-09-21 13:18:08 +02:00
Christoph M. Becker
32c6a32a18 [ci skip] Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  [ci skip] Add missing CVE to NEWS
2021-09-21 13:06:58 +02:00
Christoph M. Becker
9732381e5b [ci skip] Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  [ci skip] Add missing CVE to NEWS
2021-09-21 13:04:41 +02:00
Christoph M. Becker
96a5b4e43a [ci skip] Add missing CVE to NEWS 2021-09-21 13:02:42 +02:00
Nikita Popov
95e0cc06a2 Fix missing undef checks for comparisons 2021-09-21 12:06:32 +02:00
Dmitry Stogov
0e0f50b413 JIT x86: Fixed incorrect EX(func) initialization for recursive calls 2021-09-21 13:01:27 +03:00
Christoph M. Becker
b17adffed7 [ci skip] Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  [ci skip] Add missing NEWS entry
2021-09-21 11:46:50 +02:00
Christoph M. Becker
c014e12147 [ci skip] Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  [ci skip] Add missing NEWS entry
2021-09-21 11:44:57 +02:00
Christoph M. Becker
bb84722364 [ci skip] Add missing NEWS entry 2021-09-21 11:43:36 +02:00
Christoph M. Becker
e0b532c247 [ci skip] Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Fix persistent smart_str allocation
2021-09-21 11:03:15 +02:00
Christoph M. Becker
806cada48d [ci skip] Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix persistent smart_str allocation
2021-09-21 11:01:51 +02:00
Nikita Popov
549cb4406e Fix persistent smart_str allocation
This would allocate a too small buffer if the first smart_str
allocation is > SMART_STR_START_LEN but <= SMART_STR_START_SIZE.

(cherry picked from commit af8fccee9c)
2021-09-21 10:52:43 +02:00
Dmitry Stogov
f0f774a129 JIT x86: Fixed register clobbering in code produced for "$x[$y] %= $z". 2021-09-21 10:42:53 +03:00
Stanislav Malyshev
cebff25d27 Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Fix #81420: ZipArchive::extractTo extracts outside of destination
2021-09-20 21:35:43 -07:00
Stanislav Malyshev
f92bae23ce Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix #81420: ZipArchive::extractTo extracts outside of destination
2021-09-20 21:34:57 -07:00
Christoph M. Becker
df2ceac25a Fix #81420: ZipArchive::extractTo extracts outside of destination
We need to properly detect and handle absolute paths in a portable way.
2021-09-20 21:29:24 -07:00
George Peter Banyard
0ea38b9509 Fix Bug #81462 mime_content_type() indicates wrong arg num on TypeError 2021-09-20 22:48:00 +01:00
Christoph M. Becker
fbc922d55c Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Fix #61700: FILTER_FLAG_IPV6/FILTER_FLAG_NO_PRIV|RES_RANGE failing
2021-09-20 17:39:22 +02:00
Christoph M. Becker
288c25f7d1 Fix #61700: FILTER_FLAG_IPV6/FILTER_FLAG_NO_PRIV|RES_RANGE failing
It makes no sense to compare IPv6 address ranges as strings; there are
too many different representation possibilities.  Instead, we change
`_php_filter_validate_ipv6()` so that it can calculate the IP address
as integer array.  We do not rely on `inet_pton()` which may not be
available everywhere, at least IPv6 support may not, but rather parse
the IP address manually.  Finally, we compare the integers.

Note that this patch does not fix what we consider as reserved and
private, respectively, but merely tries to keep what we had so far.

Co-authored-by: Nikita Popov <nikita.ppv@gmail.com>

Closes GH-7476.
2021-09-20 17:38:05 +02:00
Nikita Popov
1b33da5dd2 Don't replace values in unreachable code in sccp
While technically legal, this may cause unexpected situations
(in this example, setting an FE_FREE operand to constant null)
and is suboptimal anyway. It's better to preserve the vacuous type
and drop it later (though we currently don't implement this).
2021-09-20 13:12:26 +02:00
Nikita Popov
b4d7387468 Make setcookie() test more robust against the passage of time 2021-09-20 10:28:45 +02:00
Nikita Popov
07f6c61c8e Use ephemeral ports in socket test 2021-09-20 10:19:48 +02:00
Anatol Belski
125f305b1d NEWS: Add note for bug #78987
Signed-off-by: Anatol Belski <ab@php.net>
2021-09-19 16:37:33 +02:00