Skip to content

Fix StreamHasher hashing bytes rejected by the wrapped writer - #605

Merged
AndreyVMarkelov merged 2 commits into
dropbox:mainfrom
Shubham-Padkonde:fix/hash-successful-stream-writes
Oct 7, 2026
Merged

AndreyVMarkelov merged 2 commits into
dropbox:mainfrom
Shubham-Padkonde:fix/hash-successful-stream-writes

Conversation

@Shubham-Padkonde

Copy link
Copy Markdown
Contributor

StreamHasher.write currently hashes the full input before calling the wrapped writer. A short write therefore includes bytes that were never accepted, and a failed write changes the hash despite writing nothing.

Hash only the accepted prefix after write returns, preserving its return value. Zero-byte and non-blocking writes that return None leave the hash unchanged.

Added regressions for short, zero-byte, non-blocking, and failed writes. All four fail before the fix. All 104 unit tests pass on Python 3.13, and changed-file Ruff lint and formatting checks pass. No live Dropbox API calls were needed.

@CLAassistant

CLAassistant commented Oct 2, 2026 •

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@ineil-dbx

Copy link
Copy Markdown

Hi @Shubham-Padkonde, I’ve raised this with our engineering team for further review. They’ll be able to review the pull request and address it as appropriate.

@AndreyVMarkelov
AndreyVMarkelov self-requested a review October 7, 2026 17:40
@AndreyVMarkelov
AndreyVMarkelov merged commit 3dfe03e into dropbox:main Oct 7, 2026
22 checks passed
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.

4 participants