fix: reject oversized telnet payload before header copy - #16404
Open
RainYuY wants to merge 1 commit into
Open
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## 3.3 #16404 +/- ##
=========================================
Coverage 60.87% 60.88%
- Complexity 11766 11769 +3
=========================================
Files 1953 1953
Lines 89273 89278 +5
Branches 13473 13477 +4
=========================================
+ Hits 54346 54354 +8
+ Misses 29333 29327 -6
- Partials 5594 5597 +3
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
RainYuY
requested review from
AlbumenJ,
CrazyHZM,
EarthChen,
chickenlj,
heliang666s,
oxsean and
zrlw
August 3, 2026 08:00
zrlw
reviewed
Aug 3, 2026
Contributor
It may be sufficient to only handle cases greater than 1 |
Member
Author
I don't think this change provides any meaningful behavioral benefit. When readable == 1, checkPayload is effectively a no-op because the smallest positive payload limit is 1, and the check only rejects size > payload. The current condition is correct and keeps the zero-readable case explicit, so I'd prefer to leave it as is. |
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.
When the server-side
ExchangeCodecreceives non-Dubbo input, it currently allocates and copies the entire readable buffer before the Telnet payload limit is checked. An oversized input can therefore cause an unnecessary large byte-array allocation and copy.This change validates the readable payload size in
ExchangeCodec.decode()before allocating the header buffer for non-magic server-side input.What has changed?
checkPayload(channel, readable)for non-magic server-side input.new byte[]andbuffer.readBytes(...).Tests
Added a regression test to verify that:
ExceedPayloadLimitException.Executed:
mvn -pl dubbo-remoting/dubbo-remoting-api \ -DskipITs \ -Dcheckstyle.skip \ -Drat.skip=true \ -Dtest=ExchangeCodecTest \ test