[Pkg-owncloud-commits] [owncloud] 01/457: fix #15973
David Prévot
taffit at moszumanska.debian.org
Sun Jun 28 20:05:15 UTC 2015
This is an automated email from the git hooks/post-receive script.
taffit pushed a commit to branch stable8
in repository owncloud.
commit f5415653fd975b41e0bc27fca8b0666288fc5eef
Author: jknockaert <jasper at knockaert.nl>
Date: Thu Apr 30 17:10:18 2015 +0200
fix #15973
Rework of stream_seek handling; there where basically two bugs: 1. seeking to the end of the current file would fail (with SEEK_SET); and 2. if seeking to an undefined position (outside 0,unencryptedSize) then newPosition was not defined. I used the opportunity to simplify the code.
---
lib/private/files/stream/encryption.php | 16 +++++++---------
1 file changed, 7 insertions(+), 9 deletions(-)
diff --git a/lib/private/files/stream/encryption.php b/lib/private/files/stream/encryption.php
index 0262405..e423868 100644
--- a/lib/private/files/stream/encryption.php
+++ b/lib/private/files/stream/encryption.php
@@ -356,24 +356,22 @@ class Encryption extends Wrapper {
switch ($whence) {
case SEEK_SET:
- if ($offset < $this->unencryptedSize && $offset >= 0) {
- $newPosition = $offset;
- }
+ $newPosition = $offset;
break;
case SEEK_CUR:
- if ($offset >= 0) {
- $newPosition = $offset + $this->position;
- }
+ $newPosition = $this->position + $offset;
break;
case SEEK_END:
- if ($this->unencryptedSize + $offset >= 0) {
- $newPosition = $this->unencryptedSize + $offset;
- }
+ $newPosition = $this->unencryptedSize + $offset;
break;
default:
return $return;
}
+ if ($newPosition > $this->unencryptedSize || $newPosition < 0) {
+ return $return;
+ }
+
$newFilePosition = floor($newPosition / $this->unencryptedBlockSize)
* $this->util->getBlockSize() + $this->headerSize;
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/owncloud.git
More information about the Pkg-owncloud-commits
mailing list