History log of /PHP-8.4/main/streams/streams.c (Results 1 – 25 of 368)
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
# 81916758 23-Sep-2024 Christoph M. Becker

Fix GH-15980: Signed integer overflow in main/streams/streams.c

We need to avoid signed integer overflows which are undefined behavior.
We catch that, and set `offset` to `ZEND_LONG_MAX`

Fix GH-15980: Signed integer overflow in main/streams/streams.c

We need to avoid signed integer overflows which are undefined behavior.
We catch that, and set `offset` to `ZEND_LONG_MAX` (which is also the
largest value of `zend_off_t` on all platforms). Of course, that seek
may fail, but even if it succeeds, the stream is no longer readable,
but that matches the current behavior for offsets near `ZEND_LONG_MAX`.

Closes GH-15989.

show more ...


# ee95ee72 22-Sep-2024 Christoph M. Becker

Revert "Fix GH-15980: Signed integer overflow in main/streams/streams.c"

This reverts commit 6a04c79e41bcdb8f8a62270b7d25f82698b9c5f0, since the
new test case apparently fails on 64bit L

Revert "Fix GH-15980: Signed integer overflow in main/streams/streams.c"

This reverts commit 6a04c79e41bcdb8f8a62270b7d25f82698b9c5f0, since the
new test case apparently fails on 64bit Linux, so this needs closer
investigation.

show more ...


# 6a04c79e 22-Sep-2024 Christoph M. Becker

Fix GH-15980: Signed integer overflow in main/streams/streams.c

We need to avoid signed integer overflows which are undefined behavior.
We catch that, and set `offset` to `ZEND_LONG_MAX`

Fix GH-15980: Signed integer overflow in main/streams/streams.c

We need to avoid signed integer overflows which are undefined behavior.
We catch that, and set `offset` to `ZEND_LONG_MAX` (which is also the
largest value of `zend_off_t` on all platforms). Of course, after such
a seek a stream is no longer readable, but that matches the current
behavior for offsets near `ZEND_LONG_MAX`.

Closes GH-15989.

show more ...


# 018c0b3d 16-Sep-2024 Niels Dossche <7771979+nielsdos@users.noreply.github.com>

Fix GH-15908 and GH-15026: leak / assertion failure in streams.c

This was first reported as a leak in GH-15026, but was mistakingly
believed to be a false positive. Then an assertion was

Fix GH-15908 and GH-15026: leak / assertion failure in streams.c

This was first reported as a leak in GH-15026, but was mistakingly
believed to be a false positive. Then an assertion was added and it got
triggered in GH-15908. This fixes the leak. Upon merging into master the
assertion should be removed as well.

Closes GH-15924.

show more ...


# 5853cdb7 20-Aug-2024 Gina Peter Bnayard

Use "must not" instead of "cannot" wording


# d75abdce 19-Jul-2024 Niels Dossche <7771979+nielsdos@users.noreply.github.com>

Add assertion to error path in streams.c (#15027)

This makes the developer intent clear and should prevent some false
reports.


# c087398c 23-Mar-2024 Jakub Zelenka

Fix GH-13264: Part 1 - Memory leak on filter failure

Closes GH-13790


# 5e9e9c9d 12-Jan-2024 Niels Dossche <7771979+nielsdos@users.noreply.github.com>

Fix GH-13071: Copying large files using mmap-able source streams may exhaust available memory and fail

Commit 5cbe5a538c disabled chunking for all writes to streams. However,
user stream

Fix GH-13071: Copying large files using mmap-able source streams may exhaust available memory and fail

Commit 5cbe5a538c disabled chunking for all writes to streams. However,
user streams have a callback where code is executed on data that is
subject to the memory limit. Therefore, when using large writes or
stream_copy_to_stream/copy the memory limit can easily be hit with large
enough data.

To solve this, we reintroduce chunking for userspace streams.
Users have control over the chunk size, which is neat because
they can improve the performance by setting the chunk size if
that turns out to be a bottleneck.

In an ideal world, we add an option so we can "ask" the stream whether
it "prefers" chunked writes, similar to how we have
php_stream_mmap_supported & friends. However, that cannot be done on
stable branches.

Closes GH-13136.

show more ...


# a7a6151c 16-Nov-2023 Jakub Zelenka

Fix bug #79945: Stream wrappers in imagecreatefrompng causes segfault

Closes GH-12696


# 6734880e 16-Nov-2023 Jakub Zelenka

Fix bug #79945: Stream wrappers in imagecreatefrompng causes segfault

Closes GH-12696


# 26d6bb36 27-Aug-2023 Niels Dossche <7771979+nielsdos@users.noreply.github.com>

Remove useless duplicated call to php_stream_parse_fopen_modes (#12059)


# 4a5d13e2 07-Jul-2023 Jakub Zelenka

Fix GH-11242: Use dynamic buffer for large length in stream mem copy


# 49fbbea2 10-Jun-2023 Jakub Zelenka

Fix GH-10406: fgets on a redis socket connection fails on PHP 8.3

This is an alternative implementation for GH-10406 that resets the
has_buffered_data flag after finishing stream read so

Fix GH-10406: fgets on a redis socket connection fails on PHP 8.3

This is an alternative implementation for GH-10406 that resets the
has_buffered_data flag after finishing stream read so it does not impact
other ops->read use like for example php_stream_get_line.

Closes GH-11421

show more ...


# d22d0e26 04-Feb-2023 Niels Dossche <7771979+nielsdos@users.noreply.github.com>

Implement GH-8641: STREAM_NOTIFY_COMPLETED over HTTP never emitted

This adds support for the completed event. Since the read handler could
be entered twice towards the end of the stream

Implement GH-8641: STREAM_NOTIFY_COMPLETED over HTTP never emitted

This adds support for the completed event. Since the read handler could
be entered twice towards the end of the stream we remember what the eof
flag was before reading so we can emit the completed event when the flag
changes to true.

Closes GH-10505.

show more ...


# acc94064 09-May-2023 Niels Dossche <7771979+nielsdos@users.noreply.github.com>

Remove unnecessary NULL assignments after ecalloc in streams (#11209)

ecalloc already zeroes the structure, so writing NULL is not necessary.


# 732d92c0 28-Apr-2023 Javier Eguiluz

[skip ci] Fix various typos and grammar issues (#11143)


# e787d6c9 11-Feb-2023 Niels Dossche <7771979+nielsdos@users.noreply.github.com>

Fix GH-10548: copy() fails on cifs mounts because of incorrect length (cfr_max) specified in streams.c:1584 copy_file_range() (#10551)

On some filesystems, the copy operation fails if we spe

Fix GH-10548: copy() fails on cifs mounts because of incorrect length (cfr_max) specified in streams.c:1584 copy_file_range() (#10551)

On some filesystems, the copy operation fails if we specify a size
larger than the file size in certain circumstances and configurations.
In those cases EIO will be returned as errno and we will therefore fall
back to other methods.

show more ...


# b4db690c 10-Feb-2023 Niels Dossche <7771979+nielsdos@users.noreply.github.com>

Fix GH-10370: File corruption in _php_stream_copy_to_stream_ex when using copy_file_range (#10440)

copy_file_range can return early without copying all the data. This is
legal behaviour

Fix GH-10370: File corruption in _php_stream_copy_to_stream_ex when using copy_file_range (#10440)

copy_file_range can return early without copying all the data. This is
legal behaviour and worked properly, unless the mmap fallback was used.
The mmap fallback would read too much data into the destination,
corrupting the destination file. Furthermore, if the mmap fallback would
fail and have to fallback to the regular file copying mechanism, a
similar issue would occur because both maxlen and haveread are modified.
Furthermore, there was a mmap-resource in one of the failure paths of
the mmap fallback code.
This patch fixes these issues. This also adds regression tests using the
new copy_file_range early-return simulation added in the previous
commit.

show more ...


# c8955c07 16-Jan-2023 Christoph M. Becker

Revert GH-10220

Cf. <https://github.com/php/php-src/pull/10220#issuecomment-1383739816>.

This reverts commit ecc880f491d66081298a16634629f149459706a9.
This reverts commit 588a07

Revert GH-10220

Cf. <https://github.com/php/php-src/pull/10220#issuecomment-1383739816>.

This reverts commit ecc880f491d66081298a16634629f149459706a9.
This reverts commit 588a07f7371ee2b5fac17de147926780e427fae6.
This reverts commit f377e15751d3aa48b69cd9bcc366ede7803d511f.
This reverts commit b4ba16fe189b109144aff669e11d81365160104b.
This reverts commit 694ec1deea36e366b28b6349a52be49824e1a1a8.
This reverts commit 6b34de8eba9f66882ae16e6073af28783670ac53.
This reverts commit aa1cd02a4367834026ea2205ea13a2f904455aa1.
This reverts commit 308fd311ea6fcf3094b448df7f2b264f08e4fe4f.
This reverts commit 16203b53e1822a37b6ba6f2ab198bb435d05fdad.
This reverts commit 738fb5ca5412f5e833a7fab82b11519e635a3357.
This reverts commit 9fdbefacd3c382d731aa175b7bdc002ec9cb2b30.
This reverts commit cd4a7c1d90562ebb5f89caf94d00d579631b9fbe.
This reverts commit 928685eba2b2f0ded90e7f78fd806ea164002f6e.
This reverts commit 01e5ffc85cd4357fd7b5b7ceefa29f2d10ca26b7.

show more ...


# 16203b53 04-Jan-2023 Max Kellermann

main: add missing includes


# b732d803 22-Oct-2022 Jakub Zelenka

Fix bug GH-9779: stream_copy_to_stream fail when dest in append mode


# 18fe337b 05-Oct-2022 Jakub Zelenka

Fix bug #51056: fread() on blocking stream will block even if data is available

This is applied only on socket connection which already returns
immediately if there is no data in the buf

Fix bug #51056: fread() on blocking stream will block even if data is available

This is applied only on socket connection which already returns
immediately if there is no data in the buffer.

show more ...


# d0b3096f 12-Sep-2022 Dmitry Stogov

Reset FG(user_stream_current_filename) at the end of request

Attempt to fix oss-fuzz #51047


Revision tags: php-8.2.0RC1, php-8.1.10, php-8.0.23, php-8.0.23RC1, php-8.1.10RC1, php-8.2.0beta3, php-8.2.0beta2, php-8.1.9, php-8.0.22, php-8.1.9RC1, php-8.2.0beta1, php-8.0.22RC1, php-8.0.21, php-8.1.8, php-8.2.0alpha3, php-8.1.8RC1, php-8.2.0alpha2, php-8.0.21RC1
# 0a4a55fd 20-Jun-2022 Jakub Zelenka

Allow to not close stream on rscr dtor in php cli sapi


Revision tags: php-8.0.20, php-8.1.7, php-8.2.0alpha1, php-7.4.30, php-8.1.7RC1, php-8.0.20RC1, php-8.1.6, php-8.0.19, php-8.1.6RC1, php-8.0.19RC1
# fa6d97db 23-Apr-2022 Max Kellermann

main/streams/streams: use copy_file_range() on Linux (#8413)

copy_file_range() is a Linux-specific system call which allows
efficient copying between two file descriptors, eliminating th

main/streams/streams: use copy_file_range() on Linux (#8413)

copy_file_range() is a Linux-specific system call which allows
efficient copying between two file descriptors, eliminating the need
to transfer data from the kernel to userspace and back. For
networking file systems like NFS and Ceph, it even eliminates copying
data to the client, and local filesystems like Btrfs and XFS can
create shared extents.

show more ...


12345678910>>...15