Repository navigation
Conversation
A received message whose variable-length header extension (type < 128) has a zero length field made NormMsg::GetNextExtension() return the same extension forever, hanging any 'while (GetNextExtension())' loop.
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.
NormMsg::GetNextExtension()advances to the next extension using the current extension's length field. If a variable-length extension (type < 128) has a length of 0, the offset never advances and the same extension is returned forever. Anywhile (msg.GetNextExtension(ext))loop innormNode.cppandnormSession.cppthen never exits. A received message with such an extension is enough to hang the receiving thread.This treats a zero-length variable-length extension as the end of the extension list. Fixed 4-byte extensions (type 128 and above) are unaffected.
I checked it with a small program that parses a message containing a zero-length extension and loops over
GetNextExtension(). Before the change it never terminates. After the change it ends immediately. I haven't tested it over a live session.Dukotah