fix(s2n-quic-core): enforce checked arithmetics to prevent overflows - #3081
Open
boquan-fang wants to merge 1 commit into
Open
fix(s2n-quic-core): enforce checked arithmetics to prevent overflows#3081boquan-fang wants to merge 1 commit into
boquan-fang wants to merge 1 commit into
Conversation
boquan-fang
force-pushed
the
boquan-fang/varint-overflow
branch
from
May 13, 2026 00:08
c63f398 to
d2e623e
Compare
boquan-fang
marked this pull request as ready for review
May 13, 2026 00:09
Contributor
|
the intent was to allow the application to control if it got overflow checks or not, but unfortunately, that cfg isn't stable currently: rust-lang/rust#111466, so |
Contributor
Author
ACK. I think the decision right now is to always have a check for VarInt arithmetics to prevent overflow altogether. |
Contributor
|
Have we done any type of performance analysis to prove that these checks don't add overhead? I assume we didn't want them in production for a reason. |
Contributor
Author
|
Document this behavior on the top of the file. |
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.
Release Summary:
Resolved issues:
Description of changes:
VarInt
add,mul, and other arithmetics are currently doing checked arithmetics operations during tests, but use non checked operations in production. This can cause integer overflows in production.This problem should be fixed with checked operation without the separation for production and tests. The original decision was made based on performance concerns: we believe unchecked arithmetics is faster than checked arithmetics. However, we determine that the performance regression is negligible, but the potential exposure for overflow is concerning.
Call-outs:
Testing:
Current CI should pass.
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.