fix(go): add bounds checking to DeserializeStreams for payloads > 64KB#3165
Open
atharvalade wants to merge 3 commits intoapache:masterfrom
Open
fix(go): add bounds checking to DeserializeStreams for payloads > 64KB#3165atharvalade wants to merge 3 commits intoapache:masterfrom
atharvalade wants to merge 3 commits intoapache:masterfrom
Conversation
10dedb2 to
18ae55f
Compare
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #3165 +/- ##
============================================
- Coverage 74.10% 72.79% -1.31%
Complexity 943 943
============================================
Files 1159 1117 -42
Lines 102033 96123 -5910
Branches 79083 73289 -5794
============================================
- Hits 75607 69976 -5631
+ Misses 23765 23602 -163
+ Partials 2661 2545 -116
🚀 New features to boost your workflow:
|
18ae55f to
e40eac9
Compare
|
This pull request has been automatically marked as stale because it has not had recent activity. It will be closed in 7 days if no further activity occurs. If you need a review, please ensure CI is green and the PR is rebased on the latest master. Don't hesitate to ping the maintainers - either @core on Discord or by mentioning them directly here on the PR. Thank you for your contribution! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Which issue does this PR close?
Closes #3130
Rationale
DeserializeStreamsandDeserializeToStreamhad zero bounds checking and no error propagation, causing silent data corruption for stream lists larger than 64KB.What changed?
DeserializeToStreamperformed raw slice accesses without validating that the payload contained enough bytes for the 33-byte fixed header or the variable-length name. With large payloads (>64KB), any framing misalignment caused position drift—subsequent streams were deserialized from wrong offsets, silently returning corrupted data with no error.The fix adds bounds validation before every access in
DeserializeToStream(returns error on insufficient data), propagates errors throughDeserializeStreams, and updates the TCP caller. A new test file covers single-stream, multi-stream, truncated header/name, corrupted payload, max-length name, and a 70KB+ regression test that verifies every field of ~1000 streams.Local Execution
AI Usage