Skip to content

fix: determine effective contentLength, account for tagLength on decrypt#463

Merged
kessplas merged 8 commits intomainfrom
fix-decrypt-on-next
May 20, 2025
Merged

fix: determine effective contentLength, account for tagLength on decrypt#463
kessplas merged 8 commits intomainfrom
fix-decrypt-on-next

Conversation

@kessplas
Copy link
Copy Markdown
Contributor

Issue #, if available:

Description of changes:

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

Check any applicable:

  • Were any files moved? Moving files changes their URL, which breaks all hyperlinks to the files.

@kessplas kessplas marked this pull request as ready for review May 19, 2025 21:11
@kessplas kessplas requested a review from a team as a code owner May 19, 2025 21:11
lucasmcdonald3
lucasmcdonald3 previously approved these changes May 19, 2025
// onComplete will be called before onNext is called once.
if (contentRead.get() + tagLength <= contentLength) {
// tagLength should only be added on Encrypt
if (contentRead.get() + (isEncrypt ? tagLength : 0) >= contentLength) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The equality was flipped here -- was that intentional?
It seems like it was, since it now aligns with the other checks, and (maybe?) makes more sense conceptually

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, the most sensible thing to do is to just call finalBytes from here regardless. In the vast majority of cases it'll already have been called, and simply return immediately; in the rare case(s) when it hasn't been we'll always want to send the final bytes.

@kessplas kessplas merged commit 969d721 into main May 20, 2025
14 checks passed
@kessplas kessplas deleted the fix-decrypt-on-next branch May 20, 2025 16:55
rishav-karanjit pushed a commit that referenced this pull request May 20, 2025
## [3.3.5](v3.3.4...v3.3.5) (2025-05-20)

### Fixes

* determine effective contentLength, account for tagLength on decrypt ([#463](#463)) ([969d721](969d721))
* disable low-level Multipart Upload in Async client ([#461](#461)) ([599f941](599f941))
* support PutObjectResponse fields ([#462](#462)) ([dec503b](dec503b))
josecorella pushed a commit that referenced this pull request May 21, 2025
## [3.3.5](v3.3.4...v3.3.5) (2025-05-21)

### Fixes

* determine effective contentLength, account for tagLength on decrypt ([#463](#463)) ([969d721](969d721))
* disable low-level Multipart Upload in Async client ([#461](#461)) ([599f941](599f941))
* support PutObjectResponse fields ([#462](#462)) ([dec503b](dec503b))

### Maintenance

* Revert "Amazon S3 Encryption Client 3.3.5 Release -- 2025-05-20" ([#465](#465)) ([3f9ac8e](3f9ac8e))
* update dependency needed for semantic-release  ([#464](#464)) ([0fd3b58](0fd3b58))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants