1
0
mirror of https://github.com/php/php-src.git synced 2026-03-24 08:12:21 +01:00
Commit Graph

61846 Commits

Author SHA1 Message Date
Niels Dossche
ed70b1ea43 Fix GHSA-www2-q4fc-65wf 2025-12-16 15:26:59 +01:00
Niels Dossche
8b801151bd Fix GHSA-h96m-rvf9-jgm2 2025-12-16 15:26:59 +01:00
Jakub Zelenka
727a4ddc39 Fix GHSA-8xr5-qppj-gvwj: PDO quoting result null deref 2025-12-16 15:26:59 +01:00
Niels Dossche
c5f28c7cf0 Fix GH-20584: Information Leak of Memory
The string added had uninitialized memory due to
php_read_stream_all_chunks() not moving the buffer position, resulting
in the same data always being overwritten instead of new data being
added to the end of the buffer.

This is backport as there is a security impact as described in
GHSA-3237-qqm7-mfv7 .
2025-12-16 15:26:58 +01:00
Niels Dossche
2bf2411976 Make bug70417.phpt less flaky
Closes GH-20287.

(cherry picked from commit ed9529a7d3)
2025-12-15 08:14:41 +01:00
Niels Dossche
2b04e0831a intl: Fix tests for icu update 2025-12-02 20:59:26 +01:00
Niels Dossche
688902d455 dom: Backport test for libxml changes 2025-12-02 20:52:20 +01:00
Niels Dossche
dd2179433c xml: Backport more deprecation fixes 2025-12-02 20:09:31 +01:00
Niels Dossche
903fcb45c3 Fix deprecation warning for libxml SAX header (#18594)
This header is deprecated, but fortunately it isn't actually used.
2025-12-02 18:10:46 +01:00
Niels Dossche
bd67ba66a8 dom: Fix compile warning due to misplaced const cast 2025-12-02 16:59:51 +01:00
Ilija Tovilo
f7fb13eb07 Suppress libxml deprecations
Closes GH-20538
2025-12-02 16:37:50 +01:00
Michael Orlitzky
bdf62b55bb ext/pcre/tests: support libpcre2-10.47
In the latest version of libpcre2, the offsets appearing in some
"compilation failed" warnings have increased by one, as a result of

  https://github.com/PCRE2Project/pcre2/pull/756

This is causing spurious test failures, so in this commit we replace
the hard-coded offsets by a regex that matches both values.

Gentoo-bug: https://bugs.gentoo.org/965018

Closes GH-20397
2025-11-07 18:52:48 +01:00
Ilija Tovilo
c2f4508198 [skip ci] Avoid potential network port conflict in tests
These tests:

- ext/standard/tests/network/udp4loop.phpt
- ext/sockets/tests/socket_create_listen.phpt
- ext/sockets/tests/socket_create_listen-win32.phpt

all use port 31338. socket_create_listen.phpt and its win32 variant are mutually
exclusive, so they can't conflict. While udp4loop.phpt tries multiple ports, the
other tests do not. If udp4loop.phpt runs first and socket_create_listen.phpt
starts before it ends, the port is still blocked. Bump the start port for
udp4loop.phpt to avoid conflicts.
2025-11-05 12:29:31 +01:00
Niels Dossche
c3d6bf65d5 Update zlib test to use separate file for flock()
This should prevent the nightly failures that fail with permission
denied on platforms with mandatory locks.

Closes GH-20351.
2025-11-01 09:29:45 +01:00
Ilija Tovilo
20654ce4c9 [skip ci] Unparallelize imap
It's removed for PHP 8.4 anyway, and still regularly causes "Mailbox already
exists" errors despite the flaky flag.
2025-10-28 00:48:19 +01:00
Jakub Zelenka
36859ad977 Fix curl_setopt_ssl test for curl 8.16 2025-10-07 14:18:41 +02:00
Ilija Tovilo
b810a23587 Fix more curl 8.16 issues
The CURLOPT_FOLLOWLOCATION seems like a gcc bug, where the integer extension of
bool to long is lost, but I was unable to reproduce on godbolt.org.
2025-10-07 14:18:41 +02:00
Ilija Tovilo
da75e41a6f Fix curl 8.16.0 compilation with zts 2025-10-07 14:18:41 +02:00
Niels Dossche
1c8363d2bf Fix curl build failure on macOS+curl 8.16 2025-10-07 14:18:41 +02:00
Florian Engelhardt
3aaa8d3526 Reset global pointers to prevent use-after-free
Closes GH-19212.
2025-07-30 09:22:15 +02:00
Niels Dossche
be88192594 Run FreebSD CI under 13.5
13.3 gives a 404 now.
Also pulls in a 8.4 fix to include xxhash from the bundled location.

Closes GH-19213.
2025-07-22 15:51:19 +02:00
Niels Dossche
605ee05491 Fix test conflict between chmod_variation2 and file_variation5
Both used "somelink".
See https://github.com/php/php-src/actions/runs/16427526464/job/46421461376

Closes GH-19208.
2025-07-21 23:57:21 +02:00
Tim Düsterhus
a5df26691d ext/xml: Suppress libxml deprecation for _xmlParserCtxt.inState (#19131)
The FreeBSD build fails due to the deprecation and -Werror:

    2025-07-15T00:37:20.8390774Z /home/runner/work/php-src/php-src/ext/xml/compat.c:358:38: error: 'instate' is deprecated [-Werror,-Wdeprecated-declarations]
    2025-07-15T00:37:20.8392577Z   358 |                 if (ret == NULL || parser->parser->instate == XML_PARSER_CONTENT) {
    2025-07-15T00:37:20.8393184Z       |                                                    ^
    2025-07-15T00:37:20.8394006Z /usr/local/include/libxml2/libxml/parser.h:309:33: note: 'instate' has been explicitly marked deprecated here
    2025-07-15T00:37:20.8394903Z   309 |     xmlParserInputState instate XML_DEPRECATED_MEMBER;
    2025-07-15T00:37:20.8395413Z       |                                 ^
    2025-07-15T00:37:20.8396166Z /usr/local/include/libxml2/libxml/xmlexports.h:74:50: note: expanded from macro 'XML_DEPRECATED_MEMBER'
    2025-07-15T00:37:20.8397058Z    74 |     #define XML_DEPRECATED_MEMBER __attribute__((deprecated))
    2025-07-15T00:37:20.8397581Z       |                                                  ^
    2025-07-15T00:37:20.8425542Z 1 error generated.
2025-07-16 18:23:54 +02:00
Ilija Tovilo
b6660634b4 Disable JIT on Apple Silicon + ZTS
Apple Silicon has stricter rules about rwx mmap regions. They need to be created
using the MAP_JIT flag. However, the MAP_JIT seems to be incompatible with
MAP_SHARED. ZTS requires MAP_SHARED so that some threads may execute code from a
page while another writes/appends to it. We did not find another solution, other
than completely disabling JIT for Apple Silicon + ZTS.

See discussion in https://github.com/php/php-src/pull/13351.

Co-authored-by: Peter Kokot <peterkokot@gmail.com>
Fixes GH-13400
Closes GH-13396
2025-07-03 10:34:04 -05:00
Ahmed Lekssays
9cb3d8d200 Fix GHSA-453j-q27h-5p8x
Libxml versions prior to 2.13 cannot correctly handle a call to
xmlNodeSetName() with a name longer than 2G. It will leave the node
object in an invalid state with a NULL name. This later causes a NULL
pointer dereference when using the name during message serialization.

To solve this, implement a workaround that resets the name to the
sentinel name if this situation arises.

Versions of libxml of 2.13 and higher are not affected.

This can be exploited if a SoapVar is created with a fully qualified
name that is longer than 2G. This would be possible if some application
code uses a namespace prefix from an untrusted source like from a remote
SOAP service.

Co-authored-by: Niels Dossche <7771979+nielsdos@users.noreply.github.com>
2025-06-24 23:32:34 +02:00
Jakub Zelenka
9376aeef9f Fix GHSA-hrwm-9436-5mv3: pgsql escaping no error checks
This adds error checks for escape function is pgsql and pdo_pgsql
extensions. It prevents possibility of storing not properly escaped
data which could potentially lead to some security issues.
2025-06-23 23:02:13 +02:00
Jakub Zelenka
cac8f7f1cf Fix GHSA-3cr5-j632-f35r: Null byte in hostnames
This fixes stream_socket_client() and fsockopen().

Specifically it adds a check to parse_ip_address_ex and it also makes
sure that the \0 is not ignored in fsockopen() hostname formatting.
2025-06-23 23:00:30 +02:00
Ilija Tovilo
391bd2a48f Remove bug61371 test
These tests attempt to test that no memory is leaked for stream calls. However,
it is incorrect to assume the memory will not increase for other reasons, e.g.
when growing resource buffers, for the output buffer, etc. This was discovered
through 9cacc57350 with USE_TRACKED_ALLOC=1, but
this can also fail with USE_ZEND_ALLOC=1 when increasing loop iterations.
2025-06-20 22:42:03 +02:00
Ilija Tovilo
b5081339e9 [skip ci] Increase tolerance for cve-2014-3538 tests
These regularly fail with "Failed, time=1.5x".
2025-04-24 11:26:17 +02:00
David Carlier
3fdd3ed9f7 backporting C++17 detection support for recent icu4c releases. 2025-04-23 11:01:11 +02:00
Ilija Tovilo
00ebd2d7f2 Fix flaky connection count in mysqli test
Use connection ID instead of count to check whether we're using a
persistent connection. This allows the test to be run in parallel with
the other tests, but also protects against the possibility that some
other service connects to the mysql server.

Closes GH-18040
2025-03-13 16:40:33 +01:00
Niels Dossche
0e715e71d9 Fix GHSA-wg4p-4hqh-c3g9 2025-03-11 21:50:17 +01:00
Tim Düsterhus
b6004a043c Fix GHSA-p3x9-6h7p-cgfc: libxml streams wrong content-type on redirect
libxml streams use wrong content-type header when requesting a
redirected resource.
2025-03-11 21:50:17 +01:00
Jakub Zelenka
41d49abbd9 Fix GHSA-hgf5-96fm-v528: http user header check of crlf 2025-03-11 21:50:16 +01:00
Jakub Zelenka
ac1a054bb3 Fix GHSA-52jp-hrpf-2jff: http redirect location truncation
It converts the allocation of location to be on heap instead of stack
and errors if the location length is greater than 8086 bytes.
2025-03-11 21:50:16 +01:00
Jakub Zelenka
0548c4c175 Fix GHSA-pcmh-g36c-qc44: http headers without colon
The header line must contain colon otherwise it is invalid and it needs
to fail.

Reviewed-by: Tim Düsterhus <tim@tideways-gmbh.com>
2025-03-11 21:50:16 +01:00
Jakub Zelenka
d20b4c97a9 Fix GHSA-ghsa-v8xr-gpvj-cx9g: http header folding
This adds HTTP header folding support for HTTP wrapper response
headers.

Reviewed-by: Tim Düsterhus <tim@tideways-gmbh.com>
2025-03-11 21:50:16 +01:00
Niels Dossche
f209eb448e Fix tests for libxml2 2.14
See GH-18009.
2025-03-10 20:22:11 +01:00
Ilija Tovilo
b0858427aa Suppress snmp lib memory leak, skip ASAN tests
I don't know enough about this library to fix those :(

Cherry-picked from:
be4db6b550
ba1d9d0ab2
2025-03-08 16:10:59 +01:00
Ilija Tovilo
5fcc8d4cd1 Upgrade security branches to Ubuntu 22.04
20.04 goes out of security support in 2 months. Backporting various
commits.

See d98963a071
See af721c9c36
See 378b79b90c

Closes GH-17963
2025-03-06 15:24:15 +01:00
Ilija Tovilo
8a699372f2 Fix flaky DatePeriod test
$start and $end use the H:i:s from the current time. If $end happens on
a second boundary, $start + 4 days will include $end, thus performing an
extra iteration. Fix this by setting H:i:s to 00:00:00.
2025-03-06 15:01:30 +01:00
Calvin Buckley
dc6586dd9d Skip mysqli/tests/bug73462 on PPC CI (#17971)
* Skip this test on PPC CI

Seems to be unfortunately flaky with persistent connections.

* use spaces in phpt file
2025-03-05 10:17:39 -04:00
Ilija Tovilo
726cf51236 Add CONFLICT all to random port test
If we're very unlucky, we can get the same port opened as an ephemeral
port by some other test.

Closes GH-17706
2025-02-06 15:25:16 +01:00
Christoph M. Becker
36d46a4732 Fix curl_basic_022.phpt for libcurl 8.12.0
Due to a deliberate change in libcurl, the expiration is now capped to
at most 400 days.  We could solve this by choosing another date roughly
a year in the future, but would need to update the test next year.
This would be especially annoying for security branches.

Another option would be to actually parse the cookie list lines, but
that might not be worth the trouble.  Instead we just ignore the exact
timestamp created by libcurl.

[1] <https://github.com/curl/curl/pull/15937>

Closes GH-17709.
2025-02-05 19:20:47 +01:00
Ilija Tovilo
d8aedb589c [skip ci] Another flaky phar macOS test 2025-02-04 14:52:03 +01:00
Christoph M. Becker
afe8e2cdff Relax timezone_IDforWindowsID_basic2.phpt expectations
Apparently, some ICU versions report "America/Los_Angeles" for the `ZZ`
case, what matches the behavior of ICU 76.1 (on Windows).  Possibly,
there has been some bug fix backport on some systems.  Anyhow, either
seems fine, so we're not picky about that.

Closes GH-17669.
2025-02-02 13:35:27 +01:00
Ilija Tovilo
d9744869e6 [skip ci] Another flaky macOS phar test 2025-01-28 12:58:30 +01:00
Ilija Tovilo
65b990a1e0 [skip ci] Another flaky macOS phar test 2025-01-28 12:44:24 +01:00
Ilija Tovilo
d17d58a982 Fix cve-2014-3538 test
Make sure we have a unique test file to work with, and increase the time
for the nojit version to match the default version.

Closes GH-17600
2025-01-27 20:01:13 +01:00
Jakub Zelenka
235d1b14a3 Fix GH-17499: mysqli flaky test: ghsa-h35g-vwh6-m678-stmt-row-string 2025-01-19 20:36:12 +01:00