Commit Graph

131898 Commits

Author SHA1 Message Date
Niels Dossche
911dc5b46c
Fix bug #55639: Digest autentication dont work
RFC 2617 and 7616 describe that for the "Authorization" header we should
not put the qop nor nc value inside quotes. This differs from the
WWW-Authenticate header, which may have been the source of the confusion
in the implementation. While the version with quotes seems to work fine
in some cases, clearly not all servers accept the non-standard form.
To fix the issue, simply removing the quotes of those two header fields
of the client request to be in line with the RFC suffices.

I refer further to example 3.5 in RFC 2617 and example 3.9.1 in
RFC 7616.

RFC 2617: https://datatracker.ietf.org/doc/html/rfc2617
RFC 7616: https://datatracker.ietf.org/doc/html/rfc7616

Closes GH-14328.
2024-07-17 19:23:10 +02:00
Ilija Tovilo
b368db204f
Fix comments between -> and keyword
Comments should not fall out of ST_LOOKING_FOR_PROPERTY.

Fixes GH-14961
Closes GH-14976
2024-07-16 23:40:18 +02:00
Pierrick Charron
e07813ad46
PHP-8.2 is now for PHP 8.2.23-dev 2024-07-16 12:20:55 -04:00
Ilija Tovilo
8c312ba74b
Fix use-after-free in property coercion with __toString()
This was only partially fixed in PHP-8.3. Backports and fixes the case for both
initialized and uninitialized property writes.

Fixes GH-14969
Closes GH-14971
2024-07-16 12:40:14 +02:00
Christoph M. Becker
6d0db52896
Add test case for GH-13774
Besides demonstrating the new behavior, this test also ensures that the
bundled and external libgd now behave the same.  It has to be noted,
though, that we only test one of the five code paths.

Closes GH-14945.
2024-07-14 12:46:37 +02:00
Denis Ryabov
b456ae8d34
Restore Warning instead of Fatal Error in gd_webp.c
According to the docs (https://www.php.net/manual/en/function.imagecreatefromwebp.php and https://www.php.net/manual/en/function.imagewebp.php), `false` should be returned on errors (similar to other functions of the `gd` extension), but actually all errors result in a `Fatal Error`. It doesn't look normal when trying to read an empty file or a file in the wrong format causes the program to stop. The problem seems to be related to a mega-patch that replaced `zend_error` with `zend_error_noreturn` almost everywhere. My patch fixes this behavior by switching from `zend_error_noerror` to `gd_error` (i.e. to `E_WARNING` level). All necessary memory cleanup is already in the code (as it was before the "zend_error_noreturn" patch).

Close GH-13774
2024-07-13 16:58:54 +01:00
Michael Orlitzky
09957ab9a8
ext/gd/tests/gh10614.phpt: skip if no PNG support
This test uses imagecreatefrompng(), which won't be there if libgd was
built without PNG support.

Closes GH-14905.
2024-07-10 19:50:48 +02:00
Niels Dossche
eb8c3cb79a
Fix GH-14741: Segmentation fault in Zend/zend_types.h
The create_obj handler of InternalIterator is overwritten, but not the
clone_obj handler. This is not allowed.
In PHP 8.2 this didn't cause a segfault because the standard object
handler was used for the clone instead of the internal handler.
So then it allocates and frees the object using the standard object handlers.
In 8.3 however, the object is created using the standard object handler and
freed using the custom handler, resulting in the buffer overflow.
Even though bisect points to 1e1ea4f this only reveals the bug.

Closes GH-14882.
2024-07-09 00:56:53 +02:00
Calvin Buckley
43e3f577b9 Declare that this test needs iconv extension
Otherwise it would fail with the usual recommended ./configure
invocation used for RMs testing (i.e. --disable-all).
2024-07-08 18:37:52 -03:00
Niels Dossche
c34def581a
Fix memory leak in tidy_repair_file()
When dealing with a file, we must free the contents if the function
fails. While here, also fix the error message because previously it
sounded like the filename was too long while in fact the file itself
is too large.

Closes GH-14862.
2024-07-08 13:24:32 +02:00
Niels Dossche
b44ad27a78
Fix GH-14550: No warning message when Zend DTrace is enabled that opcache.jit is implictly disabled
Closes GH-14847.
2024-07-07 13:18:01 +02:00
Niels Dossche
0d4e0c013e
Fix GH-14639: Member access within null pointer in ext/spl/spl_observer.c
`spl_object_storage_attach_handle` creates an entry already, but only
fills it in at the end with `spl_object_storage_create_element` which
allocates memory. In this case the allocation fails and we're left with
a NULL slot. Doing the allocation first isn't an option because we want
to check whether the slot is occupied before allocating memory.
The simplest solution is to set the entry to NULL and check for a NULL
pointer upon destruction.

Closes GH-14849.
2024-07-06 23:57:46 +02:00
David Carlier
237518763f
Fix GH-14774 time_sleep_until overflow. 2024-07-06 20:43:59 +01:00
Niels Dossche
0b6289dab8
[ci skip] Test is for libxml only 2024-07-06 14:41:44 +02:00
Niels Dossche
67259e451d
Fix GH-14834: Error installing PHP when --with-pear is used
libxml2 2.13 makes changes to how the parsing state is set, update our
code accordingly. In particular, it started reporting entities within
attributes, while it should only report entities inside text nodes.

Closes GH-14837.
2024-07-06 13:52:02 +02:00
Niels Dossche
a66afbbe09
NEWS for compatibility in XML
Closes GH-14836.
2024-07-06 13:49:12 +02:00
Niels Dossche
e5e15fd229
Stop setting parse options directly
Setting this directly will be deprecated in libxml2 2.14.
2024-07-06 13:46:16 +02:00
Niels Dossche
823d0588f7
Stop relying on lastError directly
Reading this directly will become deprecated in libxml2 2.14.
2024-07-06 13:46:15 +02:00
Niels Dossche
6490a18271
Stop relying on the sax2 flag directly
Setting this directly will become deprecated in libxml2 2.14.
2024-07-06 13:46:15 +02:00
Niels Dossche
8dc799aac7
Port XML_GetCurrentByteIndex to public APIs
This is necessary to avoid a deprecation break in libxml2 2.14.x.
2024-07-06 13:46:15 +02:00
Niels Dossche
1e5f46fb20
Fix test conflict between gzfile_basic.phpt and gzfile_basic2.phpt
[ci skip]

This should fix the nightly failure.
2024-07-06 01:59:32 +02:00
Niels Dossche
95889979f2
Fix GH-14553: Bug in phpdbg8.3 (also 8.1 and 8.2) echo output - trimmed at NULL byte (?)
This broke in 6318040df2 when phpdbg
stopped using its custom printing routines. By relying on standard
printing routines, the embedded NUL bytes are causing the strings to be
cut off, even when using %.*s. Solve this by going straight to the
output routine, which is what the printf routine would've done anyway.

Closes GH-14822.
2024-07-04 18:43:42 +02:00
Niels Dossche
39ed9993f7
Fix GH-13688: Test curl_basic_008 can fail (#13693)
.invalid is a reserved TLD that should never be caught.
2024-07-04 18:07:54 +02:00
Niels Dossche
1006e1021e
NEWS for GH-14814
Closes GH-14814.
2024-07-04 15:56:14 +02:00
Michael Orlitzky
27dd393be9
ext/standard/tests: strings/wordwrap_memory_limit_32bit.phpt has two outputs
It turns out that on a 32-bit system, this test can produce either the
"usual" expected output from the 64-bit test, OR the 32-bit-only
integer overflow message. We copy the dual expected outputs from
chunk_split_variation1_32bit.phpt to handle both cases.

This fixes an earlier commit that split the two tests based only on
the size of an int (32-bit versus 64-bit). The CI reveals that, at
least on a debug/zts build, the "64-bit" memory limit error (and not
the integer overflow error) is still produced.
2024-07-04 15:55:05 +02:00
Michael Orlitzky
68a0efedeb
ext/standard/tests: 32bit wordwrap tests aren't just for Windows
The test in strings/wordwrap_memory_limit.phpt has a counterpart in
strings/wordwrap_memory_limit_win32.phpt. The two are conditional on
both the OS name and the size of an int (32- versus 64-bits).

A Gentoo Linux user has however reported that the 64-bit test fails on
a 32-bit system, with precisely the error message that the "win32"
test is expecting. I don't have any 32-bit hardware to test myself,
but I think it's reasonable to conclude that the OS name is not an
essential part of the test: it's simply 32- versus 64-bit.

This commit drops the conditionals for the OS name. Now one test will
be run on 32-bit systems, and the other on 64-bit systems, regardless
of the OS name.

Bug: https://bugs.gentoo.org/935382
2024-07-04 15:55:04 +02:00
Niels Dossche
89c3e0346a
Fix GH-14808: Unexpected null pointer in Zend/zend_string.h with empty output buffer
The output buffer can be NULL when the number of bytes is zero.

Closes GH-14815.
2024-07-04 15:49:58 +02:00
Ilija Tovilo
a380cdb996
[skip ci] Fix exlusion of buggy Symfony test 2024-07-04 15:44:09 +02:00
Niels Dossche
a5a63f2904
[ci skip] NEWS 2024-07-04 15:32:05 +02:00
Niels Dossche
4fe821311c
Backport libxml2 2.13.2 fixes (#14816)
Backproted from https://github.com/php/php-src/pull/14789
2024-07-04 15:29:50 +02:00
Niels Dossche
7b74cadf8c
Fix uninitialized (dummy) memory in php_strtr_array() (#14812)
Fixes one issue in GH-14806.
2024-07-04 13:34:33 +02:00
Michael Orlitzky
a8d1955348
ext/standard/tests: use %d instead of bytes in an overflow message
In strings/chunk_split_variation1_32bit.phpt, we have a test that is
expected to fail on x32 with a possible integer overflow error. The
message reports the exact number of bytes -- a number big enough to
overflow an int on x32 -- stemming from a memory allocation in
chunk_split().

This number appears unpredictable, and is not the point of the test.
We replace it with %d to make the test independent of the allocation
details.
2024-07-04 00:48:01 +02:00
Arnaud Le Blanc
070779c874
Fix test race condition
Closes GH-14790
2024-07-03 19:17:13 +02:00
Go Kudo
cd67080236
[ci skip] fix NEWS typo (#14777) 2024-07-03 14:53:33 +09:00
David Carlier
2edf12e87f
Fix GH-14638: null dereference after XML parsing failure.
object document is null if the parsing had failed prior to cast to
string.
2024-07-01 22:36:32 +01:00
Peter Kokot
98cb0be17d
Use pattern tags for NDBM ext/dba/tests (#14755) 2024-07-01 22:06:10 +02:00
Niels Dossche
8fd095669a
Factor out common check for short-circuited ast 2024-06-30 13:38:14 +02:00
Niels Dossche
d568337680
Fix OSS-Fuzz #69765: Yield reference to nullsafe chain
You cannot return or yield a reference to a nullsafe chain. This was
checked already in zend_compile_return but not yet in
zend_compile_yield.

Closes GH-14716.
2024-06-30 13:38:06 +02:00
David Carlier
c03196a5be
Fix GH-14712: segfault on invalid object.
If the extension does not allow to get a property pointer (like PDORow
object), we fallback
to the read property cb anyway.
2024-06-29 15:51:57 +01:00
Niels Dossche
b08def5156
Fix GH-14563: Build failure with libxml2 v2.13.0
Remove xmlErrMemory from the export section for Windows, this fixes the
build. Even though the original function was renamed [1] it is hidden,
so removing this should be sufficient and not be a BC break.

[1] 130436917c

Closes GH-14719.
2024-06-29 16:28:16 +02:00
Niels Dossche
42908f9f68
Fix GH-14702: DOMDocument::xinclude() crash
The xinclude code from libxml removes the fallback node,
but the fallback node is still reference via $fallback.
The solution is to detach the nodes that are going to be removed in
advance.

Closes GH-14704.
2024-06-28 22:21:12 +02:00
Niels Dossche
056bec72f4
Fix GH-14590: Memory leak in FPM test gh13563-conf-bool-env.phpt
Values retrieved from zend_getenv should be freed.
Note: The only possible value for `zend_getenv` is `sapi_getenv` which uses
zend alloc to duplicate the string that it reads from the SAPI module.

Closes GH-14708.
2024-06-28 22:05:15 +02:00
Niels Dossche
643762cd78
[ci skip] Move incorrectly placed NEWS items to the right place 2024-06-28 20:16:19 +02:00
Niels Dossche
39a3266576
Fix GH-14537: shmop Windows 11 crashes the process
The error handling code isn't entirely right in two places.
One of the code blocks is dead because of an always-false condition, and
another code block is missing the assignment of a NULL pointer.

Getting the exact same behaviour is not entirely possible because you
can't extend the size of a shared memory region after it was made with
the Windows APIs we use, unless we destroy the region and recreate it,
but that has other consequences.
However, it certainly shouldn't crash.

Closes GH-14707.
2024-06-28 20:13:47 +02:00
Niels Dossche
5a32b510ef
Add SKIPIFs for upstream regression in libxslt (#14674)
See https://gitlab.gnome.org/GNOME/libxslt/-/issues/113
2024-06-26 19:35:52 +02:00
Arnaud Le Blanc
a9acc29a37
[ci skip] NEWS for GH-14626 2024-06-25 15:15:17 +02:00
Arnaud Le Blanc
1ff277dee2
Fix is_zend_ptr() for huge blocks (#14626)
is_zend_ptr() expected zend_mm_heap.huge_list to be circular, but it's in fact NULL-terminated. It could crash when at least one huge block exists and the ptr did not belong to any block.
2024-06-25 15:14:00 +02:00
Arnaud Le Blanc
d7ef2c209a
[ci skip] NEWS for GH-13922 2024-06-24 19:55:47 +02:00
Arnaud Le Blanc
3fbca7fb6a
Support sysconf(_SC_GETPW_R_SIZE_MAX) == -1 (#13922) 2024-06-24 19:52:55 +02:00
David Carlier
686afc10bf
Fix GH-14603: invalid null zip file entry.
close GH-14610
2024-06-21 05:07:46 +01:00