Commit Graph

135458 Commits

Author SHA1 Message Date
David CARLIER
dad2d561e8
adding const attribute to trailing/leading zeros helpers. (#13861)
and adding noreturn to php_sighup_handler for compiler/dev clarification sake.
2024-04-02 12:10:18 +01:00
Niels Dossche
ce2dd0b20b
Fix potential NULL pointer argument to memcpy (#13859)
This is only possible when the length is 0, but memcpy doesn't like NULL
pointers, as UBSAN trips over it.
2024-04-01 22:47:38 +02:00
Niels Dossche
eb1cdb5b72
Fix opline argument for getting the function info for range()
Short-lived regression from 00c6d538ab,
where in one of its commits (that was squashed) not all changes were
reverted correctly.
2024-04-01 22:42:18 +02:00
Dmitry Stogov
50573904b8 Update IR
IR commit: 1689cad28a7af72043a0bc10a04ec8d9dc04b368
2024-04-01 23:35:03 +03:00
Niels Dossche
b9a2533cb3
Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix gcc-14 Wcalloc-transposed-args warnings
2024-04-01 20:34:44 +02:00
Niels Dossche
e34c86ce1a
Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Fix gcc-14 Wcalloc-transposed-args warnings
2024-04-01 20:34:37 +02:00
Cristian Rodríguez
18d70db091
Fix gcc-14 Wcalloc-transposed-args warnings
gcc-14 and later warns of inverted arguments in calloc or
calloc-like __alloc_size__ annotated functions.

Closes GH-13818.
2024-04-01 20:34:14 +02:00
Niels Dossche
0dc599853a
Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix GH-13856: Member access within null pointer of type 'ps_files' in ext/session/mod_files.c
2024-04-01 14:16:28 +02:00
Niels Dossche
3f598a3073
Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Fix GH-13856: Member access within null pointer of type 'ps_files' in ext/session/mod_files.c
2024-04-01 14:16:23 +02:00
Niels Dossche
46f45a51b4
Fix GH-13856: Member access within null pointer of type 'ps_files' in ext/session/mod_files.c
We should not mark the session as opened when there was a failure in
open.

Closes GH-13858.
2024-04-01 14:15:51 +02:00
Niels Dossche
17f936eec7
[ci skip] NEWS 2024-04-01 13:49:27 +02:00
Niels Dossche
00c6d538ab
Fix GH-13834: Applying non-zero offset 36 to null pointer in zend_jit.c (#13846)
* Fix GH-13834: Applying non-zero offset 36 to null pointer in zend_jit.c

ssa_op can be NULL in function JIT. Doing pointer arithmetic on a NULL
pointer is undefined behaviour. Undefined behaviour can be dangerous
because the optimizer may assume then that the variable is not actually
NULL.

To solve this:
1. Add ADVANCE_SSA_OP() to safely add an offset to ssa_op in zend_jit.c
2. For inference, add an extra offset argument to the helper functions.

To reproduce this, use Clang (not GCC) on a test like
sapi/cli/tests/gh12363.phpt (or other tests also work).

* Remove -fno-sanitize=pointer-overflow flag from CI

* Fix NULL pointer offsets added to the stack_map

* Fix an offset add on a potentially NULL ssa->ops

* Fix NULL pointer arithmetic in zend_range_info()

* Address review comments
2024-04-01 13:37:15 +02:00
Niels Dossche
c3f5bbde2a
Simplify always-true check in zend_generator_update_current (#13848)
`old_root` is dereferenced at top, so `old_root` must not be NULL, and
the check doesn't actually do anything.
2024-04-01 13:29:09 +02:00
Niels Dossche
30885f3b5f
Implement request #71571: XSLT processor should provide option to change maxDepth (#13731)
There are two depth limiting parameters for XSLT templates.
1) maxTemplateDepth
   This corresponds to the recursion depth of a template. For very
   complicated templates this can be hit.
2) maxTemplateVars
   This is the total number of live variables. When using recursive
   templates with lots of parameters you can hit this limit.

This patch introduces two new properties to XSLTProcessor that
corresponds to the above variables.
2024-03-31 21:21:23 +02:00
David Carlier
089f51319e Merge branch 'PHP-8.3' 2024-03-31 17:01:27 +01:00
David Carlier
b412fd6a77 Merge branch 'PHP-8.2' into PHP-8.3 2024-03-31 17:01:16 +01:00
David Carlier
ba4c82fd80 ext/sockets: socket_create_listen clearing socket data before binding.
Close GH-13855
2024-03-31 17:00:54 +01:00
Niels Dossche
2d83b60b6c
Merge branch 'PHP-8.3'
* PHP-8.3:
  Skip test on Windows because of different error output
2024-03-31 16:56:27 +02:00
Niels Dossche
b34e838874
Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Skip test on Windows because of different error output
2024-03-31 16:56:21 +02:00
Niels Dossche
5ed5d37f25
Skip test on Windows because of different error output 2024-03-31 16:56:14 +02:00
Niels Dossche
33c2d6b9a4
Remove redundant check in mysqlnd_conn_data::connect (#13849)
`conn` is dereferenced at top so it is always non-NULL.
2024-03-31 16:16:49 +02:00
Niels Dossche
f6447b337e
Remove redundant check in mysqlnd_fetch_stmt_row_cursor (#13850)
result is always non-NULL because it is dereferenced above.
Similarly, result->unbuf and stmt must also be non-NULL.
2024-03-31 16:16:27 +02:00
Niels Dossche
eaaf175bbb
Remove redundant check in pdo_raise_impl_error (#13851)
`dbh` is always non-NULL because it is dereferenced at the start of the
function.
2024-03-31 16:16:17 +02:00
Niels Dossche
f590df442f
Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix GH-13833: Applying zero offset to null pointer in zend_hash.c
2024-03-31 14:25:47 +02:00
Niels Dossche
b1a6832287
Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Fix GH-13833: Applying zero offset to null pointer in zend_hash.c
2024-03-31 14:25:39 +02:00
Niels Dossche
47bb6c1b79
Fix GH-13833: Applying zero offset to null pointer in zend_hash.c
MAPPHAR_FAIL will call the destructor of the manifest, mounted_dirs, and
virtual_dirs tables. When a new phar object is allocated using (p)ecalloc,
the bytes are zeroed, but the flag for an uninitialized table is
non-zero. So we have to manually set the flag in case that we have a
code path that can destroy the tables without first initializing them at
least once.

Closes GH-13847.
2024-03-31 14:25:08 +02:00
David Carlier
376061e73b
Merge branch 'PHP-8.3' 2024-03-30 22:22:00 +00:00
Fabrice Fontaine
5a043c26c8
Zend/zend_call_stack.c: fix build for Linux/uclibc-ng without pthread.
Fix the following build failure without pthread raised since version
8.3.0 and
a11c8a3039:

/home/buildroot/instance-0/output-1/build/php-8.3.4/Zend/zend_call_stack.c:39:11: fatal error: pthread.h: No such file or directory
   39 | # include <pthread.h>
      |           ^~~~~~~~~~~

Fixes:
 - http://autobuild.buildroot.org/results/a4ef648a9da50b26ed56d5d490e4cf5a1bfff970

Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>

Close GH-13843
2024-03-30 22:19:02 +00:00
Jakub Zelenka
bd3b684e04
Merge branch 'PHP-8.3' 2024-03-30 18:37:51 +00:00
Jakub Zelenka
b7992d4eb7 Fix OpenSSL error string tests 2024-03-30 18:36:34 +00:00
Niels Dossche
0c3b389d2c
Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix GH-13836: Renaming a file in a Phar to an already existing filename causes a NULL pointer dereference
2024-03-30 18:04:35 +01:00
Niels Dossche
6a23c7fa91
Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Fix GH-13836: Renaming a file in a Phar to an already existing filename causes a NULL pointer dereference
2024-03-30 18:04:29 +01:00
Niels Dossche
ed8ed714a8
Fix GH-13836: Renaming a file in a Phar to an already existing filename causes a NULL pointer dereference
If the destination already exists, then the `add` function on the
manifest will return NULL, resulting in a NULL entry and therefore a
NULL deref. As `copy()` (not `Phar::copy`) chooses to succeed and
overwrite the destination if it already exists, we should do the same.
Therefore the fix is as simple as changing `add` to `update`.

Closes GH-13840.
2024-03-30 18:03:55 +01:00
Jakub Zelenka
dbe35f6d2a
Merge branch 'PHP-8.3' 2024-03-30 14:38:41 +00:00
Jakub Zelenka
1b585d2620
Merge branch 'PHP-8.2' into PHP-8.3 2024-03-30 14:38:19 +00:00
Jakub Zelenka
9b1d2e93b8
Fix FPM tester default env vars change
This broke cloexec test
2024-03-30 14:37:54 +00:00
Juan Morales
186465b1dd
QA - finfo_open - increase test coverage (#13839) 2024-03-30 15:16:06 +01:00
Jakub Zelenka
4d7e3fcb86
Merge branch 'PHP-8.3' 2024-03-29 19:40:03 +00:00
Jakub Zelenka
9cf0f30193
Merge branch 'PHP-8.2' into PHP-8.3 2024-03-29 19:39:15 +00:00
Jakub Zelenka
11caf094f1
Fix GH-13620: Failing openssl_private_decrypt tests
Use OPENSSL_PKCS1_OAEP_PADDING padding in tests

Closes GH-13667
2024-03-29 19:33:37 +00:00
Peter Kokot
6c2d5e5f1c
Fix linking library for POSIX shared memory functions (#13822)
The POSIX shared memory object operations functions (shm_open,
shm_unlink...) are in:
* C library on most systems (newer Linux, Solaris 11.4, illumos, BSD*,
  macOS, Haiku, etc.)
* real-time (rt) library on older Linux distributions and Solaris <= 10.

Haiku C library (called root library) on Haiku is linked in by default.

Previous check always added additional rt or root library to global LIBS
and rt to OPCACHE_SHARED_LIBADD. Now, the library containing shm_open is
linked as needed to the always shared opcache extension.

This also removes unused HAVE_SHM_OPEN and HAVE_LIBROOT symbols.
2024-03-29 20:16:09 +01:00
Niels Dossche
f2b2b7f257 Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix GH-13827: Null pointer access of type 'zval' in phpdbg_frame
2024-03-29 17:55:52 +01:00
Niels Dossche
508ed9b474 Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Fix GH-13827: Null pointer access of type 'zval' in phpdbg_frame
2024-03-29 17:55:33 +01:00
Niels Dossche
d3f1f3ab40 Fix GH-13827: Null pointer access of type 'zval' in phpdbg_frame
We don't always have the line and filename in a backtrace frame, but
phpdbg assumes we do.

Closes GH-13831.
2024-03-29 17:54:23 +01:00
Jakub Zelenka
09f5e7921e
Merge branch 'PHP-8.3' 2024-03-29 16:33:44 +00:00
Jakub Zelenka
5231e71bfd
Merge branch 'PHP-8.2' into PHP-8.3 2024-03-29 16:33:26 +00:00
Jakub Zelenka
100258ffd6
Fix test for GH-10495: feof on OpenSSL stream hangs 2024-03-29 16:32:23 +00:00
Jakub Zelenka
af41d58d6f
Merge branch 'PHP-8.3' 2024-03-29 16:25:40 +00:00
Jakub Zelenka
f4a9ae90f9
Merge branch 'PHP-8.2' into PHP-8.3 2024-03-29 16:25:09 +00:00
Jakub Zelenka
c1bd9a932a
Fix GH-10495: feof on OpenSSL stream hangs indefinitely
This fixes the issue with unbounded waiting on SSL_peek which can happen
when only part of the record is fetched. It makes socket non blocking so
it is possible to verify if OpenSSL is expecting some more data or if
there is an error.

This also fixes bug #79501

Closes GH-13487
2024-03-29 16:22:22 +00:00