mirror of
https://github.com/php/php-src.git
synced 2025-08-15 21:48:51 +02:00
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.
This commit is contained in:
parent
81aedad452
commit
b4db690cb3
8 changed files with 170 additions and 4 deletions
|
@ -53,6 +53,7 @@ ZEND_BEGIN_MODULE_GLOBALS(zend_test)
|
|||
int replace_zend_execute_ex;
|
||||
int register_passes;
|
||||
bool print_stderr_mshutdown;
|
||||
zend_long limit_copy_file_range;
|
||||
zend_test_fiber *active_fiber;
|
||||
zend_long quantity_value;
|
||||
zend_string *str_test;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue