Skip to content

Reserve alignment slack in SSLBuffer max capacity - #3642

Open
samuel40791765 wants to merge 1 commit into
aws:mainfrom
samuel40791765:sslbuffer-max-capacity-overflow
Open

samuel40791765 wants to merge 1 commit into
aws:mainfrom
samuel40791765:sslbuffer-max-capacity-overflow

Conversation

@samuel40791765

@samuel40791765 samuel40791765 commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor

Description of changes:

#2673 raised SSLBUFFER_MAX_CAPACITY to INT_MAX, but SSLBuffer places data at an alignment offset of up to SSL3_ALIGN_PAYLOAD - 1 bytes and tracks offset_/cap_ as int. With read ahead and a maximally sized read buffer, consuming the whole buffer could push offset_ past INT_MAX.
This caps the buffer at INT_MAX - (SSL3_ALIGN_PAYLOAD - 1) so offset_ + cap_ always fits in an int. There were also some stale comments after #2673 raised the limit, so this fixes that as well.

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

aws#2673 raised SSLBUFFER_MAX_CAPACITY to INT_MAX, but SSLBuffer places data
at an alignment offset of up to SSL3_ALIGN_PAYLOAD - 1 bytes and tracks
offset_/cap_ as int. With read ahead and a maximally sized read buffer,
consuming the whole buffer could push offset_ past INT_MAX. This caps the
buffer at INT_MAX - (SSL3_ALIGN_PAYLOAD - 1) so offset_ + cap_ always fits
in an int, and updates the stale 0xffff comments and docs.
@samuel40791765
samuel40791765 requested a review from a team as a code owner October 9, 2026 20:13
@samuel40791765
samuel40791765 requested review from WillChilds-Klein, prasden and skmcgrail and removed request for prasden October 9, 2026 20:15
@github-actions

github-actions Bot commented Oct 9, 2026

Copy link
Copy Markdown
Contributor

🔒 Security Review — View Report

Please review before merging.

@codecov-commenter

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 78.72%. Comparing base (b5c4a2b) to head (f443aaa).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3642      +/-   ##
==========================================
+ Coverage   78.69%   78.72%   +0.02%     
==========================================
  Files         705      705              
  Lines      130689   130689              
  Branches    17919    17919              
==========================================
+ Hits       102850   102880      +30     
+ Misses      26860    26828      -32     
- Partials      979      981       +2     

☔ 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.

@samuel40791765

Copy link
Copy Markdown
Contributor Author

msys clang CI failures fixed with this PR: #3645

@samuel40791765
samuel40791765 enabled auto-merge (squash) October 11, 2026 00:36

This branch has not been deployed

No deployments
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