1
0
mirror of https://github.com/php/php-src.git synced 2026-04-17 13:01:02 +02:00
Commit Graph

57942 Commits

Author SHA1 Message Date
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
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
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
fafdf744fa Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  fileinfo: Fix test value for s390x on travis-ci
2021-09-19 16:04:35 +02:00
Anatol Belski
8f75ab0dfc fileinfo: Fix test value for s390x on travis-ci
Signed-off-by: Anatol Belski <ab@php.net>
2021-09-19 16:02:30 +02:00
Anatol Belski
d225770e9e Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  fileinfo: Capture more sizes for test as delivered by travis-ci
  fileinfo: Capture more sizes for test as delivered by AppVeyor
2021-09-18 23:17:41 +02:00
Anatol Belski
6e0acece68 fileinfo: Capture more sizes for test as delivered by travis-ci
Signed-off-by: Anatol Belski <ab@php.net>
2021-09-18 23:16:38 +02:00
Anatol Belski
e56435c86d fileinfo: Capture more sizes for test as delivered by AppVeyor
Signed-off-by: Anatol Belski <ab@php.net>
2021-09-18 23:06:57 +02:00
Anatol Belski
a4f85a5796 Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  fileinfo: Adjust value in test
2021-09-18 22:52:30 +02:00
Anatol Belski
0208374ad4 fileinfo: Adjust value in test
Signed-off-by: Anatol Belski <ab@php.net>
2021-09-18 22:51:08 +02:00
Anatol Belski
3c40d9bf77 libmagic: Update patch
Signed-off-by: Anatol Belski <ab@php.net>
2021-09-18 22:04:32 +02:00
Anatol Belski
2a9a521d71 Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  fileinfo: Fixed bug #78987 High memory usage during encoding detection
2021-09-18 22:02:56 +02:00
Anatol Belski
fa96c7e000 fileinfo: Fixed bug #78987 High memory usage during encoding detection
The default buffer size for the encoding detection is set to 64K.

Signed-off-by: Anatol Belski <ab@php.net>
2021-09-18 21:00:30 +02:00
Dmitry Stogov
01cfd5e4f9 JIT: Fixed incorrect assignment of undefined variable 2021-09-17 18:35:55 +03:00
Nikita Popov
a49a309386 Fix FETCH_OBJ_IS type inference
Even if the property is typed, null is still a valid return
value in the BP_VAR_IS case. Other cases will throw instead.
2021-09-17 17:05:25 +02:00
Dmitry Stogov
015cafa38c JIT: keep register value across call 2021-09-17 17:58:24 +03:00
Dmitry Stogov
04209de93c JIT: Fixed warning when assign undefined variable to property 2021-09-17 16:22:06 +03:00
Christoph M. Becker
fac3fbcb07 Fix OOB read due to timezone_open() with 5 digit offset
This has been reported as bug #78984, and is generally and properly
fixed as of timelib 2020.3 (PHP-8.0).  However, it is not fixed in
PHP-7.4, where the test results in an OOB read, and an unterminated
C string when calling `::getName()`.  Therefore, we apply a minimal
fix which just avoids this dangerous behavior.
2021-09-17 13:18:51 +02:00
Nikita Popov
d46b10296e Don't jit FE_RESET_R with undef operand
The implementation currently assumes that the operand is always
an array, but this did not account for a possibly undef operand.
2021-09-17 12:04:21 +02:00
Dmitry Stogov
5e3eaf14fe JIT: Fixed memory leak in BOOL_NOT when opearnd ia a reference to bool 2021-09-16 17:18:51 +03:00
Nikita Popov
83f283f5ea Undef result on throwing typed reference assignment 2021-09-16 15:48:10 +02:00
Nikita Popov
4c8093a9f1 Don't const evaluate increment of array in SCCP 2021-09-16 14:43:08 +02:00
Nikita Popov
1548418461 Fix may_throw for ASSIGN_OBJ
The code did not account for a number of possible exceptions.
2021-09-16 12:46:53 +02:00
Christoph M. Becker
f55d78e817 Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Fix #70962: XML_OPTION_SKIP_WHITE strips embedded whitespace
2021-09-16 12:06:36 +02:00
Aliaksandr Bystry
a9661a5293 Fix #70962: XML_OPTION_SKIP_WHITE strips embedded whitespace
We must never strip embedded whitespace; we only need to skip values
when that option is set, and make sure that we keep BC regarding the
different behavior for "cdata" and "complete" elements (for the former,
the whole element is skipped; for the latter only the "value" key).

We also fix erroneous `int` types which should actually be `size_t`.

Co-authored-by: Christoph M. Becker <cmbecker69@gmx.de>

Closes GH-7493.
2021-09-16 12:00:28 +02:00
Nikita Popov
7257e7e5aa Handle SWITCH_STRING with optimized away FREE
This can happen in degenerate cases where we know that the
SWITCH_STRING argument is not refcounted. We should be treating it
in the same way as SWITCH_LONG here.
2021-09-16 11:31:06 +02:00
Dmitry Stogov
236e7aef01 JIT: Fixed call chain construction 2021-09-15 17:27:05 +03:00
Nikita Popov
6de8b08f60 Don't undef result operand if there is none
The mod_by_zero and negative_shift helper may also be used by
ASSIGN_OP, in which case there is not necessarily a result operand.
If the stars aligned just right, this used to clobber other parts
of the call frame.

For these two helpers, check whether the result_type is TMP/VAR
before setting to UNDEF:
2021-09-15 14:49:13 +02:00
Dmitry Stogov
23327bf4b3 Fixed error message 2021-09-15 15:00:49 +03:00
Dmitry Stogov
de20a89b06 Fixed error message 2021-09-15 14:58:55 +03:00
Dmitry Stogov
594cba7f8e Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Fixed bug #79576 ("TYPE *" shows unhelpful message when type is not defined)
2021-09-15 14:49:35 +03:00
Dmitry Stogov
0badc7de96 Fixed bug #79576 ("TYPE *" shows unhelpful message when type is not defined) 2021-09-15 14:48:33 +03:00
Nikita Popov
3ee85ccd4a Handle undef assignment to typed ref 2021-09-15 10:58:01 +02:00
Nikita Popov
10bbff8758 Fix JIT for recursive call with too few args
We may not generate labels for all leading RECVs. Don't generate
a direct jump if we have less arguments than required.
2021-09-14 15:15:14 +02:00
Nikita Popov
10e9f6b340 Fix func/class name use after free on opcache OOM condition
This can occur on opcache OOM conditions, where the function/class
names are not interned and the script does not get cached. In
that case the functions/classes get transferred from the persistent
script to the global tables, without incrementing the key refcount.
To mirror that, we should also not try to free the keys when freeing
the persistent script. For this by setting the number of elements
to zero, which will free only the hashtable structure itself.
2021-09-14 12:00:44 +02:00
Nikita Popov
1b376b06fb Fix BIND_STATIC may_throw check
This is supposed to index into arData, not the HashTable itself.
2021-09-14 10:09:32 +02:00