Skip to content

Conversation

@artonge
Copy link
Contributor

@artonge artonge commented Oct 24, 2025

When computing the unencrypted file size, we need the size of the last encrypted chunk as its size is usually not the regular 8192 bits.

To avoid reading the whole file, we seek directly to that last chunk based on the expected file size. When the expected file size is smaller than the actual one, we have a logic in place to continue reading until we reach the end of the file.

In that logic, we forgot to increment the $lastChunkNr which is important when we later check the signature of the chunk.

This commit adds that missing increment.

@artonge artonge changed the title fix(encryption): Increment lastChunkNr when size is off fix(encryption): Increment lastChunkNr when size is off Oct 28, 2025
@artonge artonge marked this pull request as ready for review November 19, 2025 12:41
@artonge artonge requested a review from a team as a code owner November 19, 2025 12:41
@artonge artonge requested review from leftybournes, provokateurin, salmart-dev and yemkareems and removed request for a team November 19, 2025 12:41
@artonge artonge self-assigned this Nov 19, 2025
@artonge artonge added bug 3. to review Waiting for reviews feature: encryption (server-side) php Pull requests that update Php code labels Nov 19, 2025
@artonge artonge added this to the Nextcloud 33 milestone Nov 19, 2025
@artonge
Copy link
Contributor Author

artonge commented Nov 19, 2025

/backport to stable32

@artonge
Copy link
Contributor Author

artonge commented Nov 19, 2025

/backport to stable31

When computing the unencrypted file size, we need the size of the last encrypted chunk as its size is usually not the regular 8192 bits.

To avoid reading the whole file, we seek directly to that last chunk based on the expected file size. When the expected file size is smaller than the actual one, we have a logic in place to continue reading until we reach the end of the file.

In that logic, we forgot to increment the `$lastChunkNr` which is important when we later check the signature of the chunk.

This commit adds that missing increment.

Signed-off-by: Louis Chmn <[email protected]>
@artonge artonge force-pushed the artonge/fix/encryption/increment_lastChunkNr branch from 10b8610 to 30d567f Compare November 21, 2025 16:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants