Skip to content

Properly handle negative values to _EncryptionStream.read() #98

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Nov 9, 2018
Merged

Properly handle negative values to _EncryptionStream.read() #98

merged 4 commits into from
Nov 9, 2018

Conversation

mattsb42-aws
Copy link
Member

Issue #, if available: #26

Description of changes:
The actual fix was tiny. Most of this PR is refactoring the test class from unittest to pytest.

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

@mattsb42-aws mattsb42-aws requested a review from a team November 8, 2018 20:11
@@ -209,6 +209,10 @@ def read(self, b=None):
:returns: Processed (encrypted or decrypted) bytes from source stream
:rtype: bytes
"""
# Any negative value for b is interpreted as a full read
Copy link
Contributor

Choose a reason for hiding this comment

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

What is a full read?

Copy link
Member Author

Choose a reason for hiding this comment

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

A full read means "read the entire message", and is triggered when either the number of bytes is not specified or when a negative value is specified.

https://docs.python.org/3/library/io.html#io.RawIOBase.read

@mattsb42-aws mattsb42-aws merged commit 7013f40 into aws:master Nov 9, 2018
@mattsb42-aws mattsb42-aws deleted the read branch November 9, 2018 00:43
This was referenced Nov 13, 2018
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