router: fix buffer overflow double-counting when decoding buffer and data are the same object#44346
Open
wdauchy wants to merge 5 commits intoenvoyproxy:mainfrom
Open
router: fix buffer overflow double-counting when decoding buffer and data are the same object#44346wdauchy wants to merge 5 commits intoenvoyproxy:mainfrom
wdauchy wants to merge 5 commits intoenvoyproxy:mainfrom
Conversation
…data are the same object When an upstream filter (e.g. envoy.filters.http.buffer) buffers the entire request body before passing it to the router, the shared buffered_request_data_ is passed directly as the `data` argument to decodeData(). The buffer overflow check computed `decodingBuffer().length() + data.length()`, but since both refer to the same object, this double-counted the payload size. This caused requests with body size between limit/2 and limit to incorrectly trigger buffer overflow, setting request_buffer_overflowed_ and cancelling internal redirects. The fix detects pointer equality between decodingBuffer() and data, mirroring the existing same-buffer guard in commonHandleBufferData(). tentative fix for envoyproxy#44128 Signed-off-by: William Dauchy <william.dauchy@datadoghq.com>
wbpcode
reviewed
Apr 9, 2026
Signed-off-by: William Dauchy <william.dauchy@datadoghq.com>
Contributor
Author
|
/retest transients |
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.
Commit Message:
When an upstream filter (e.g. envoy.filters.http.buffer) buffers the entire request body before passing it to the router, the shared buffered_request_data_ is passed directly as the
dataargument to decodeData(). The buffer overflow check computeddecodingBuffer().length() + data.length(), but since both refer to the same object, this double-counted the payload size.This caused requests with body size between limit/2 and limit to incorrectly trigger buffer overflow, setting request_buffer_overflowed_ and cancelling internal redirects.
The fix detects pointer equality between decodingBuffer() and data, mirroring the existing same-buffer guard in commonHandleBufferData().
tentative fix for #44128
Additional Description:
Risk Level:
Testing:
Docs Changes:
Release Notes:
Platform Specific Features:
[Optional Runtime guard:]
[Optional Fixes #Issue]
[Optional Fixes commit #PR or SHA]
[Optional Deprecated:]
[Optional API Considerations:]