Commit Graph

120464 Commits

Author SHA1 Message Date
George Peter Banyard
7b3ac296a5 Fix mismatch between macro and struct definition 2020-09-03 14:01:45 +02:00
Nikita Popov
9464576f29 Fix leaks in sapi tests
Make sure to always free compiled_filename on shutdown.
2020-09-03 12:59:30 +02:00
Nikita Popov
7620ea1580 Don't intern compiled_filename
For php-ast interning the file name is an effective memory leak,
see php-ast#134.

I don't think there's any reason to do this. At some point this
was needed due to bugs in the interned string mechanism that
caused issues if the string was later interned, e.g. through a
__FILE__ reference. These issues have since been resolved.

In conjunction with the filenames_table removal in c4016ecd44
this means that filenames now need to be refcounted like normal
strings. In particular the filename reference in op_arrays and CEs
are refcounted.
2020-09-03 12:31:23 +02:00
Nikita Popov
c4016ecd44 Remove CG(filenames_table)
This doesn't seem to serve any purpose anymore.
2020-09-03 11:33:54 +02:00
Nikita Popov
397a692735 Merge branch 'PHP-7.4'
* PHP-7.4:
  Fixed bug #80046
2020-09-03 11:19:11 +02:00
Nikita Popov
8516434a56 Fixed bug #80046
We already protect against optimizing away loop frees in DFA pass,
but not in block pass.
2020-09-03 11:19:04 +02:00
Nikita Popov
ce74ff2b3d Merge branch 'PHP-7.4'
* PHP-7.4:
  Fixed bug #80046
2020-09-03 11:18:11 +02:00
Nikita Popov
04e77d2dea Fixed bug #80046
We already protect against optimizing away loop frees in DFA pass,
but not in block pass.
2020-09-03 11:18:01 +02:00
Dmitry Stogov
67e9b3be39 JIT for FE_FETCH_R 2020-09-03 12:06:06 +03:00
Christoph M. Becker
7769ae18a1 Merge branch 'PHP-7.4' into master
* PHP-7.4:
  Skip test if A: drive exists
2020-09-03 10:33:35 +02:00
Christoph M. Becker
658ad4d046 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Skip test if A: drive exists
2020-09-03 10:30:39 +02:00
Christoph M. Becker
c70a938f28 Skip test if A: drive exists
Otherwise the test case will fail for a very different reason.
2020-09-03 10:29:38 +02:00
Nikita Popov
3b853c97f3 Fixed bug #80045
Applying the obvious fix ... however, I think we may need to
rething how we handle trampoline fcc for "f" zpp. It might make
sense to use fcc->function_handler == NULL for that case and
force it to be fetched in zend_call_function instead (it will
be reset to that after the call anyway). Otherwise we will keep
chasing these leaks, as it's the only instance where it's
necessary to free a zpp result.
2020-09-03 10:29:18 +02:00
Nikita Popov
daf222c9f8 Merge branch 'PHP-7.4'
* PHP-7.4:
  Handle memory limit error during string reallocation correctly
2020-09-03 09:51:54 +02:00
Nikita Popov
0fc65ed133 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Handle memory limit error during string reallocation correctly
2020-09-03 09:51:35 +02:00
Dmitry Stogov
6b521a98d4 Fixed support for deprecated constants (Zend/tests/const_deprecation.phpt failure) 2020-09-03 10:49:58 +03:00
Nikita Popov
573ad182d2 Handle memory limit error during string reallocation correctly
Do not decrement the refcount before allocating the new string,
as the allocation operation may bail out and cause a use-after-free
lateron. We can only decrement the refcount once the allocation
has succeeded.

Fixes oss-fuzz #25384.
2020-09-03 09:49:29 +02:00
Dmitry Stogov
91edb90767 JIT for FETCH_CONSTANT 2020-09-03 00:51:43 +03:00
Dmitry Stogov
508f8285e2 Reorder switch cases for consistency between zend_jit() and zend_jit_trace() 2020-09-02 23:16:58 +03:00
Anatol Belski
e64c386b62 libmagic: Update patch
[ci skip]

Signed-off-by: Anatol Belski <ab@php.net>
2020-09-02 21:25:24 +02:00
Alex Dowad
73dcfb6faa Fix typos in mbstring tests
Man, I can be pedantic sometimes. Tiny little things like misspelled words just
hurt me inside. So while it's not really a big deal, I couldn't leave these typos
alone...
2020-09-02 20:48:22 +02:00
Benjamin Eberlei
842be67b60 Update NEWS, UPGRADING 2020-09-02 20:32:52 +02:00
Benjamin Eberlei
8b37c1e993 Change Attribute Syntax from @@ to #[] 2020-09-02 20:26:50 +02:00
Anatol Belski
f2b40775af Revert "libmagic: Move the allocation on the stack"
This reverts commit 1d84a58736.

Signed-off-by: Anatol Belski <ab@php.net>
2020-09-02 20:04:00 +02:00
Dmitry Stogov
f3f5719355 JIT for FE_FETCH_R 2020-09-02 20:10:02 +03:00
Anatol Belski
8c31001bf1 libmagic: Constify arg 2020-09-02 17:35:51 +02:00
Anatol Belski
1d84a58736 libmagic: Move the allocation on the stack 2020-09-02 17:35:51 +02:00
Anatol Belski
3d1e7d37eb hash: Fix warning in the bench script 2020-09-02 17:35:51 +02:00
Nikita Popov
05cd31ef64 Extend function blacklist in execute fuzzer
Add pfsockopen and stream_socket_server.
2020-09-02 17:30:19 +02:00
Nikita Popov
0bc2657b2f Merge branch 'PHP-7.4'
* PHP-7.4:
  Fix binary-safety of parse_url
2020-09-02 16:46:49 +02:00
Nikita Popov
81811dbbfb Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix binary-safety of parse_url
2020-09-02 16:45:57 +02:00
Nikita Popov
54dbd3eccc Fix binary-safety of parse_url
php_parse_url() is intended to support strings that are not zero
terminated. We can't use strcspn in the implementation.

As we have two uses of strcspn, add a helper.
2020-09-02 16:45:25 +02:00
Dmitry Stogov
0d157cf526 Micro-optimization 2020-09-02 17:31:48 +03:00
Frank Du
c3299d7dab X86: Fast CRC32 computation using PCLMULQDQ instruction
Based on:
"Fast CRC Computation for Generic Polynomials Using PCLMULQDQ Instruction"
V. Gopal, E. Ozturk, et al., 2009, http://intel.ly/2ySEwL0

Signed-off-by: Frank Du <frank.du@intel.com>

Closes GH-6018
2020-09-02 15:10:41 +02:00
Michael Voříšek
cb284f668c Fix typo in test description
Closes GH-6062.
2020-09-02 13:07:40 +02:00
Dmitry Stogov
4d97ab20fc Added missing helper 2020-09-02 12:59:52 +03:00
Dmitry Stogov
225cd9da86 Improved JIT for VERIFY_RETURN_TYPE 2020-09-02 12:55:16 +03:00
Máté Kocsis
3e800e997b
Move custom type checks to ZPP
Closes GH-6034
2020-09-02 11:11:38 +02:00
Nikita Popov
ddc2a2d381 Merge branch 'PHP-7.4'
* PHP-7.4:
  Fix throwing of yield from related exceptions into generator
2020-09-02 10:53:44 +02:00
Nikita Popov
c6fd37cee3 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix throwing of yield from related exceptions into generator
2020-09-02 10:53:13 +02:00
Nikita Popov
2e9e706a82 Fix throwing of yield from related exceptions into generator
Use the general zend_generator_throw_exception() helper for this.
Otherwise we don't handle the off-by-one opline correctly (should
we maybe just stop doing that?)

This is a followup to ad750c3bb6,
which fixed a different yield from exception handling problem that
happened to show up in the same test case from oss-fuzz #25321.
Now both issues should be fixed.
2020-09-02 10:52:55 +02:00
Dmitry Stogov
c98e1747a8 Minimal JIT support for JMP_NULL 2020-09-02 11:49:42 +03:00
Nikita Popov
8b6b2bda09 Fix by-ref list assign LIST_W+MAKE_REF separation
Shift the responsibility for emitting MAKE_REF to the list assignment
code, to make sure that LIST_W and MAKE_REF are directly adjacent,
and there are no opcodes in between that could modify the LIST_W
result.

Additionally, adjust the zend_wrong_string_offset() code to not
perform a loop over opcodes and assert that the next opcode is
a relevant one. The VM write-safety model requires this.

This is a followup to a07c1f56aa
and the full fix for oss-fuzz #25352.
2020-09-02 10:26:55 +02:00
Nikita Popov
aedc7b0fb4 Merge branch 'PHP-7.4'
* PHP-7.4:
  Fix infinite loop on string offset during by-ref list assign
2020-09-02 10:16:46 +02:00
Nikita Popov
605ee9c8eb Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix infinite loop on string offset during by-ref list assign
2020-09-02 10:16:35 +02:00
Nikita Popov
a07c1f56aa Fix infinite loop on string offset during by-ref list assign
There is a deeper underlying issue here, in that the opcodes violate
VM write-fetch safety, but let's fix the infinite loop first.

This fixes oss-fuzz #25352.
2020-09-02 10:16:05 +02:00
Dmitry Stogov
7484b8f036 Preallocate zval for unused result of internal function on CPU stack 2020-09-02 02:03:38 +03:00
Nikita Popov
a8687804bb Disable ifunc resolvers under dataflow sanitizer
As with other sanitizers, this is not supported.
2020-09-01 20:37:43 +02:00
Nikita Popov
c6ea0e90c2 Assert there are children in zend_generator_get_child() 2020-09-01 20:37:43 +02:00
Gabriel Caruso
1e8e8ab6c9 Update NEWS for 8.0.0rc1 2020-09-01 17:19:26 +00:00