diff options
author | Nikita Popov <nikita.ppv@gmail.com> | 2019-07-17 15:59:22 +0200 |
---|---|---|
committer | Nikita Popov <nikita.ppv@gmail.com> | 2019-07-17 15:59:22 +0200 |
commit | 56a2ea7aa24be71e0190262f1c01090c50841c5b (patch) | |
tree | 85b0c1aec59bb43ea6416c55bcc12220c41d7c2e /main/streams | |
parent | 07a4d134abd07690f9921eb0d0c7eeb671b0b875 (diff) | |
parent | 79efd55fc366e3b33c6730f0bfa2cbf9f89d4368 (diff) | |
download | php-git-56a2ea7aa24be71e0190262f1c01090c50841c5b.tar.gz |
Merge branch 'PHP-7.3' into PHP-7.4
Diffstat (limited to 'main/streams')
-rw-r--r-- | main/streams/plain_wrapper.c | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/main/streams/plain_wrapper.c b/main/streams/plain_wrapper.c index e0bc980e5d..83681c0d88 100644 --- a/main/streams/plain_wrapper.c +++ b/main/streams/plain_wrapper.c @@ -695,18 +695,15 @@ static int php_stdiop_set_option(php_stream *stream, int option, int value, void return fd == -1 ? PHP_STREAM_OPTION_RETURN_ERR : PHP_STREAM_OPTION_RETURN_OK; case PHP_STREAM_MMAP_MAP_RANGE: - if(do_fstat(data, 1) != 0) { + if (do_fstat(data, 1) != 0) { return PHP_STREAM_OPTION_RETURN_ERR; } - if (range->length == 0 && range->offset > 0 && range->offset < data->sb.st_size) { - range->length = data->sb.st_size - range->offset; - } - if (range->length == 0 || range->length > data->sb.st_size) { - range->length = data->sb.st_size; - } - if (range->offset >= data->sb.st_size) { + if (range->offset > data->sb.st_size) { range->offset = data->sb.st_size; - range->length = 0; + } + if (range->length == 0 || + range->length > data->sb.st_size - range->offset) { + range->length = data->sb.st_size - range->offset; } switch (range->mode) { case PHP_STREAM_MAP_MODE_READONLY: |