Skip to content

Commit

Permalink
Fix #80048: Bug #69100 has not been fixed for Windows
Browse files Browse the repository at this point in the history
We fix the erroneous length calculation on Windows, too.

Closes GH-6067.
  • Loading branch information
cmb69 committed Sep 3, 2020
1 parent c70a938 commit 1848ccd
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
3 changes: 3 additions & 0 deletions NEWS
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@ PHP NEWS
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
?? ??? ????, PHP 7.3.23

- Core:
. Fixed bug #80048 (Bug #69100 has not been fixed for Windows). (cmb)

- Calendar:
. Fixed bug #80007 (Potential type confusion in unixtojd() parameter parsing).
(Andy Postnikov)
Expand Down
12 changes: 4 additions & 8 deletions main/streams/plain_wrapper.c
Original file line number Diff line number Diff line change
Expand Up @@ -786,15 +786,11 @@ static int php_stdiop_set_option(php_stream *stream, int option, int value, void
}

size = GetFileSize(hfile, NULL);
if (range->length == 0 && range->offset > 0 && range->offset < size) {
range->length = size - range->offset;
}
if (range->length == 0 || range->length > size) {
range->length = size;
}
if (range->offset >= size) {
if (range->offset > size) {
range->offset = size;
range->length = 0;
}
if (range->length == 0 || range->length > size - range->offset) {
range->length = size - range->offset;
}

/* figure out how big a chunk to map to be able to view the part that we need */
Expand Down

0 comments on commit 1848ccd

Please sign in to comment.