Commit Graph

115151 Commits

Author SHA1 Message Date
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
Nikita Popov
f92a03627a Check for null EX(func) in write_property
This can happen if zend_call_function inserted a dummy frame,
and we already switched to the dummy frame in leave_helper,
and an exception is thrown during CV destruction.

Fixes oss-fuzz #25343.
2020-09-01 15:16:41 +02:00
Nikita Popov
37612936a1 Fix pi node removal when removing predecessor
We can't just remove the uses, we need to replace uses.

The test case only fails on master with SSA integrity violations,
but I believe the root issue also existed previously.
2020-09-01 12:25:00 +02:00
Nikita Popov
9560e3ba7a Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix leak on assign concat of array and empty string
2020-08-31 17:05:55 +02:00
Nikita Popov
cd2afd99b1 Fix leak on assign concat of array and empty string 2020-08-31 17:05:31 +02:00
Nikita Popov
1f6f9c70cb Fix leak on consteval exception in ReflectionClass::__toString() 2020-08-31 15:10:09 +02:00
Nikita Popov
8bb2f406de Check update constant failure in ReflectionClassConstant::__toString() 2020-08-31 14:50:20 +02:00
Derick Rethans
41e11a8e71 Merge branch 'PHP-7.3' into PHP-7.4 2020-08-31 12:31:44 +01:00
Derick Rethans
488e53c18b Fixed test case 2020-08-31 12:31:23 +01:00
Derick Rethans
932b735822 Merge branch 'PHP-7.3' into PHP-7.4 2020-08-31 11:41:57 +01:00
Derick Rethans
778902db63 Update timelib to 2018.04 2020-08-31 11:41:41 +01:00
Nikita Popov
dfaa4768d2 Fix bug #80037
If we're accessing an uninitialized typed property and __get is
defined, don't perform a read_property callback, as __get is
supposed to have no effect on uninitialized typed properties.
Usually it doesn't, but by-reference assignments cannot be
performed through read_property.

I'm deleting the test for bug #80039 again, as it doesn't really
make sense anymore with this fix.
2020-08-31 12:17:00 +02:00
Nikita Popov
8f7c529720 Add test for bug #80039
This has already been fixed by 247105ae1a,
but let's add the additional test case.
2020-08-31 11:22:16 +02:00
Matteo Beccati
42b6b8a3ae Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix #80027 Terrible performance using $query->fetch on queries with many bind parameters
2020-08-31 11:08:26 +02:00
Matteo Beccati
44ade0e875 Fix #80027 Terrible performance using $query->fetch on queries with many bind parameters
Added new flags that allow skipping param_evt(s) that are not used by drivers,
in a backwards and forward compatible manner. Updated the pgsql, mysql, sqlite
and oci drivers to properly use the new flags. I've left out pdo_dblib, which
doesn't have a param_hook, and pdo_firebird, which seems to be using
PARAM_EVT_NORMALIZE in a wrong context (param type vs event type).
2020-08-31 11:03:03 +02:00
Nikita Popov
b396fb348b Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix handling of exception if valid() during yield from
2020-08-31 10:51:49 +02:00
Nikita Popov
ad750c3bb6 Fix handling of exception if valid() during yield from
Fixes oss-fuzz #25296.
2020-08-31 10:51:31 +02:00
Nikita Popov
c45985d266 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Make MAX_IFD_NESTING_LEVEL an actual nesting level
2020-08-31 09:32:55 +02:00
Nikita Popov
376bbbdf3b Make MAX_IFD_NESTING_LEVEL an actual nesting level
Currently we only ever increment ifd_nesting_level, so this ends up
being a limit on the total number of IFD tags and we regularly get
bug reports of it being exceeded. I think the intention behind this
limit was to prevent recursion stack overflow, and for that we only
need to check actual recursive usage. I've implemented that here,
and dropped the nesting limit down to a smaller value
(which still passes our tests).

However, it seems that we do also need to have a total limit on
the number of tags, as we don't catch some instances of infinite
looping otherwise. Add this as a separate limit with a higher
value, that should hopefully be sufficient.

This is expected to fix a number of bugs:

https://bugs.php.net/bug.php?id=78083
https://bugs.php.net/bug.php?id=78701
https://bugs.php.net/bug.php?id=79907
https://bugs.php.net/bug.php?id=80016
2020-08-31 09:28:59 +02:00
twosee
45ed9b42a5 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Improve error_handing replacement functions
2020-08-30 16:25:12 +08:00
twosee
e948188832 Improve error_handing replacement functions
We explicitly skip calls to user_error_handler in EH_THROW mode

Closes GH-6050.
2020-08-30 16:24:42 +08:00
Nikita Popov
5ae657b296 Don't assert when comparing uninit DateTimeZone objects
Nothing guarantees that the objects are initialized here... just
check as usual.
2020-08-27 16:18:45 +02:00
Nikita Popov
8daf79215d Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Require non-negative length in stream_get_contents()
2020-08-27 15:51:35 +02:00
Nikita Popov
62dce97973 Require non-negative length in stream_get_contents()
If the length is not -1, require it to be non-negative.

Using such lengths doesn't make sense (as only -1 is special-case
to read in chunks, anything else will end up doing a huge upfront
allocation) and can lead to string allocation overflow.

A similar check is already in place for file_get_contents(). That
one does not allow -1 (and uses null instead), but this function
is explicitly specified to accept -1, so stick to that behavior.
2020-08-27 15:50:49 +02:00
Christoph M. Becker
296030119c Catch potential exceptions during to string conversion
As of PHP 7.4.0, exceptions are allowed to be thrown from inside
`__toString()` methods; we have to cater to that, and catch these
exceptions early.

Closes GH-6042
2020-08-27 10:23:18 +02:00
Nikita Popov
247105ae1a Property handle read_property exception in fetch_property_address
Otherwise we leak (and corrupt uninitialized_zval).
2020-08-26 16:12:34 +02:00
Christoph M. Becker
8e2f219fad Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix com_safearray_proxy related memory management issues
2020-08-26 15:40:57 +02:00
Christoph M. Becker
1b7ee6db88 Fix com_safearray_proxy related memory management issues 2020-08-26 15:39:32 +02:00
Christoph M. Becker
b087bd2404 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Separate COM::__construct()s $server_name array
2020-08-26 15:01:22 +02:00
Christoph M. Becker
75ac3f1cba Separate COM::__construct()s $server_name array
This may otherwise be modified.
2020-08-26 15:00:02 +02:00
Christoph M. Becker
1ff981d7a6 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix #64130: COM obj parameters passed by reference are not updated
2020-08-26 14:53:46 +02:00
Christoph M. Becker
5ff15e2651 Fix #64130: COM obj parameters passed by reference are not updated
`ITypeInfo_GetIDsOfNames()` is supposed to fail with `E_NOTIMPL` for
out-of-process servers, thus we should not remove the already available
typeinfo of the object in this case.

We also properly free the `byref_vals`.
2020-08-26 14:50:04 +02:00
Nikita Popov
358721bcf7 Fix file name clash in test 2020-08-26 12:32:06 +02:00
Nikita Popov
0487bcfac7 Avoid socket path clash in test 2020-08-26 12:11:22 +02:00
Nikita Popov
bf3e772361 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix memory leak when yielding from non-iterable
2020-08-26 11:32:31 +02:00
Nikita Popov
d179e34e42 Fix memory leak when yielding from non-iterable 2020-08-26 11:32:01 +02:00
Nikita Popov
571f6a598f Don't enable --with-mm in CI
Turns out this has a large negative effect on startup time,
making tests much slower.
2020-08-25 20:25:07 +02:00
Christoph M. Becker
923a14626c Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Avoid double-free
2020-08-25 13:12:41 +02:00
Christoph M. Becker
3324bb893e Avoid double-free
As of commit b2e3fd1[1] the `authid.User` is no longer newly allocated,
so we must not free it.

[1] <http://git.php.net/?p=php-src.git;a=commit;h=b2e3fd1e691b1dc82aaaf4150461db97bd5acf4a>
2020-08-25 13:11:22 +02:00
Nikita Popov
86e7aa20ad Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Remove bogus REGISTER_LONG_CONSTANT
2020-08-25 12:35:54 +02:00
Nikita Popov
063082043a Remove bogus REGISTER_LONG_CONSTANT
This shouldn't be in this function, probably a copy/paste mistake...
2020-08-25 12:35:38 +02:00
Christoph M. Becker
5dd1877ca1 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix potential integer overflow detected by oss-fuzz
2020-08-24 17:36:50 +02:00
Christoph M. Becker
74de17f2ea Fix potential integer overflow detected by oss-fuzz
We port the respective fix from upstream[1].

[1] <9ed642764c>
2020-08-24 17:35:04 +02:00
Nikita Popov
bb54694f4f Fix refcounting 2020-08-24 16:23:19 +02:00
Christoph M. Becker
6b6c2c003c Fix #79979: passing value to by-ref param via CUFA crashes
If a by-val send is not allowed, we must not do so.  Instead we wrap
the value in a temporary reference.

Closes GH-6000
2020-08-24 14:08:32 +02:00
Christoph M. Becker
5ab7b30cd6 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix #79986: str_ireplace bug with diacritics characters
2020-08-24 11:09:38 +02:00
Christoph M. Becker
844a2dd6ac Fix #79986: str_ireplace bug with diacritics characters
`tolower()` returns an `int`, so we must not convert to `char` which
may be `signed` and as such may be subject to overflow (actually,
implementation defined behavior).

Closes GH-6007
2020-08-24 11:08:48 +02:00
Christoph M. Becker
10df94dd0e Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix #80002: calc free space for new interned string is wrong
2020-08-24 11:04:03 +02:00
Christoph M. Becker
fcd26ffcc3 Fix #80002: calc free space for new interned string is wrong
We need to calculate the free size in bytes.

Patch contributed by t-matsuno.

Closes GH-6024
2020-08-24 11:03:19 +02:00