Fix uint32 overflow in receive buffer growth - #6226
Open
Gaurav Singh (gaurav2699) wants to merge 17 commits into
Open
Fix uint32 overflow in receive buffer growth#6226Gaurav Singh (gaurav2699) wants to merge 17 commits into
Gaurav Singh (gaurav2699) wants to merge 17 commits into
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #6226 +/- ##
==========================================
- Coverage 86.02% 85.63% -0.40%
==========================================
Files 60 60
Lines 18984 18987 +3
==========================================
- Hits 16331 16259 -72
- Misses 2653 2728 +75 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
| // This is the largest power of two that fits in a uint32_t, ensuring the buffer | ||
| // doubling logic never overflows. | ||
| // | ||
| #define QUIC_RECV_BUFFER_MAX_VIRTUAL_LENGTH 0x80000000U |
Collaborator
There was a problem hiding this comment.
Please don't define arbitrary constant only for arithmetic overflow. They are generally not needed.
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.
Description
Cap internally-managed stream receive buffers at 0x80000000 during
auto-tuning and compute buffer growth in 64-bit, rejecting sizes above
UINT32_MAX. This prevents a uint32 wrap that could spin the growth loop
forever when a very large ConnFlowControlWindow is configured. App-owned
mode behavior is unchanged.
Fixes https://dev.azure.com/microsoft/OS/_workitems/edit/62826267/
Testing
Added RecvBufferGrowthTest.WriteGrowthOverflow to cover the overflow
boundary. Existing recv buffer tests pass.
Documentation
NA