GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | |
GeezerVison is showing github.com — Port 5.0: Don't lose frames when a delimiter is split across reads (#17911) by normanmaurer · Pull Request #17917 · netty/netty Conversation
Member
Auto-port of #17665 to 5.0 Motivation: When
Single-byte delimiters, and line delimiters (which are handled by Modification:
Result: Frames are not lost when a multi-byte delimiter is split across reads. Co-authored-by: allthingssecurity [email protected]
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactions…17911) Auto-port of #17665 to 5.0 Cherry-picked commit: 07aed99 --- Motivation: When `DelimiterBasedFrameDecoder` finds no delimiter in the buffer, it counts all readable bytes as frame content and, while discarding a too long frame, skips all of them. That includes a trailing partial delimiter whose remaining bytes are in the next read. With a multi-byte delimiter, this loses frames. In both examples below the delimiter is `##` and `maxFrameLength` is 4: - While a too long frame is discarded, the first bytes of the delimiter that ends it are thrown away. The delimiter is never seen, so discarding continues through the next valid frame, which is lost silently. For example, `AAAAAAAAAA#` then `#ok##next##` gives `TooLongFrameException, next`: the `ok` frame is lost. With `failFast = false`, the two frames are also reported as a single exception. - A frame of up to `maxFrameLength` bytes is rejected when a read ends inside its delimiter, because the partial delimiter is counted. For example, `ABCD#` then `#ok##` gives only `TooLongFrameException`: `ABCD` is lost, and `ok` too (by the first case). Single-byte delimiters, and line delimiters (which are handled by `LineBasedFrameDecoder`), are not affected. Modification: - When no delimiter is found, compute the longest suffix of the buffer that is the beginning of a delimiter, and don't count or skip it. This check only runs when no delimiter was found. It compares at most `delimiter length - 1` bytes per delimiter, next to the existing search of the whole buffer. - New tests in `DelimiterBasedFrameDecoderTest`: - a frame of `maxFrameLength` bytes with its delimiter split across reads; - a delimiter split across reads while discarding, with and without `failFast`; - `maxFrameLength` is still enforced when the delimiter is split. Result: Frames are not lost when a multi-byte delimiter is split across reads. The limit is still exact: the branch that finds the delimiter checks it as before. --------- Co-authored-by: allthingssecurity <[email protected]> Co-authored-by: Norman Maurer <[email protected]> …ders (#17912) Motivation: SocksCmdRequestDecoder and SocksCmdResponseDecoder read the DOMAIN address length octet (RFC 1928), and SocksAuthRequestDecoder reads ULEN and PLEN (RFC 1929), as signed bytes. Wire values 0x80..0xFF sign-extend to -128..-1, so spec-legal domain names, user names and passwords of 128 to 255 bytes cannot be decoded. This also means frames produced by SocksCmdRequest, SocksCmdResponse and SocksAuthRequest, which accept up to 255 characters, are rejected by their own decoders. Modification: Read the four length octets as unsigned values. Add regression tests with 128 and 255 byte domain names, user names and passwords for each decoder. Result: The legacy SOCKS5 decoders accept every length value the protocol allows.
normanmaurer
force-pushed
the
port-17912-socks-unsigned-5.0
branch
from
148315f to
aeec6a6
Compare
All reactions
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. Uh oh!
There was an error while loading. Please reload this page.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
ReviewersNo reviewsUh oh!
There was an error while loading. Please reload this page. AssigneesNo one assignedLabels
None yet
ProjectsDevelopmentSuccessfully merging this pull request may close these issues. Uh oh!
There was an error while loading. Please reload this page. 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. | |
| You are visitor 01402775 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |