Skip to content

Fix uint32 overflow in receive buffer growth - #6226

Open
Gaurav Singh (gaurav2699) wants to merge 17 commits into
mainfrom
buffer_autotuning
Open

Fix uint32 overflow in receive buffer growth#6226
Gaurav Singh (gaurav2699) wants to merge 17 commits into
mainfrom
buffer_autotuning

Conversation

@gaurav2699

@gaurav2699 Gaurav Singh (gaurav2699) commented Aug 13, 2026

Copy link
Copy Markdown
Contributor

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

@gaurav2699
Gaurav Singh (gaurav2699) requested a review from a team as a code owner August 13, 2026 13:17
@codecov

codecov Bot commented Aug 13, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 85.63%. Comparing base (e0f55b5) to head (3acb4fc).
⚠️ Report is 1 commits behind head on main.

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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Comment thread src/core/recv_buffer.h
// 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

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Please don't define arbitrary constant only for arithmetic overflow. They are generally not needed.

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