Skip to content

Conversation

@come-nc
Copy link
Contributor

@come-nc come-nc commented May 11, 2023

Summary

On 32bits sizes may be floats. There were a few places where this was still not taken into account.

I did not fix the following:

lib/private/Files/ObjectStore/S3.php:           return (int)$stat->get('ContentLength');
lib/private/Files/ObjectStore/ObjectStoreStorage.php:           $stat['size'] = (int)$size;

Because it would bubble up to the interface IObjectStoreMultiPartUpload in OCP, and I’m not sure if it is possible/easy to support floats there.

Also did not fix:

lib/private/Files/Stream/Encryption.php:                        $positionInFile = (int)floor($this->position / $this->unencryptedBlockSize) *
lib/private/Files/Stream/Encryption.php:                $newFilePosition = (int)floor($newPosition / $this->unencryptedBlockSize)
lib/private/Files/Stream/Encryption.php:                $position = (int)floor($this->position / $this->unencryptedBlockSize);
lib/private/Files/Stream/Encryption.php:                        $position = (int)floor($this->position / $this->unencryptedBlockSize);
lib/private/Files/Stream/Encryption.php:                        $completeBlocksInFile = (int)floor($this->unencryptedSize / $this->unencryptedBlockSize);
lib/private/Files/Stream/Encryption.php:                        if ($completeBlocksInFile === (int)floor($this->position / $this->unencryptedBlockSize)) {
lib/private/Files/Stream/Encryption.php:                        $position = (int)floor($this->position / $this->unencryptedBlockSize);
lib/private/Files/Stream/Encryption.php:                        $numberOfChunks = (int)($this->unencryptedSize / $this->unencryptedBlockSize);

It’s not clear if those can overflow or not.

Checklist

@come-nc come-nc added bug 2. developing Work in progress labels May 11, 2023
@come-nc come-nc self-assigned this May 11, 2023
Signed-off-by: Côme Chilliet <[email protected]>
@come-nc come-nc added 3. to review Waiting for reviews and removed 2. developing Work in progress labels May 15, 2023
@come-nc come-nc added this to the Nextcloud 27 milestone May 15, 2023
@come-nc come-nc requested review from a team, ArtificialOwl, artonge, icewind1991, nfebe and szaimen and removed request for a team May 15, 2023 12:40
@szaimen szaimen removed their request for review May 15, 2023 12:42
@come-nc
Copy link
Contributor Author

come-nc commented May 15, 2023

/backport to stable26

@come-nc
Copy link
Contributor Author

come-nc commented May 15, 2023

/backport to stable25

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

3. to review Waiting for reviews bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Error “Your storage is full, files can not be updated or synced anymore!"

4 participants