diff options
| author | Christoph M. Becker <cmbecker69@gmx.de> | 2020-09-21 16:09:17 +0200 |
|---|---|---|
| committer | Christoph M. Becker <cmbecker69@gmx.de> | 2020-09-21 16:09:17 +0200 |
| commit | 6fa2493789f8f05c7a53eca803227fcfb1bf2573 (patch) | |
| tree | 92bcd4e140b9b20795d64df791ac717600a3d9d6 /main/streams/plain_wrapper.c | |
| parent | e95fa3eb0ce97d952598f599052a837ba90f2df2 (diff) | |
| parent | 19c844594e40d79cea016b54f9ab3a367440b4c9 (diff) | |
| download | php-git-6fa2493789f8f05c7a53eca803227fcfb1bf2573.tar.gz | |
Merge branch 'PHP-7.4' into master
* PHP-7.4:
Fix mmap copying
Diffstat (limited to 'main/streams/plain_wrapper.c')
| -rw-r--r-- | main/streams/plain_wrapper.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/main/streams/plain_wrapper.c b/main/streams/plain_wrapper.c index 350dc2ec40..9d21116707 100644 --- a/main/streams/plain_wrapper.c +++ b/main/streams/plain_wrapper.c @@ -829,6 +829,11 @@ static int php_stdiop_set_option(php_stream *stream, int option, int value, void delta = (DWORD)range->offset - loffs; } + /* MapViewOfFile()ing zero bytes would map to the end of the file; match *nix behavior instead */ + if (range->length + delta == 0) { + return PHP_STREAM_OPTION_RETURN_ERR; + } + data->last_mapped_addr = MapViewOfFile(data->file_mapping, acc, 0, loffs, range->length + delta); if (data->last_mapped_addr) { |
