Repository navigation
Conversation
PerMessageDeflateExtension.decode looped while the Inflater did not need input. After a DEFLATE block with BFINAL set, which RFC 7692 section 7.2.3.4 allows, the Inflater is finished and returns 0 while the trailing bytes stay unconsumed, so the loop never exits and a single compressed frame pins the server thread. The client-side PerMessageDeflate decoder did stop, but never reset the finished Inflater, so later messages decoded to empty payloads. Stop inflating once the stream is finished and reset the Inflater so the next DEFLATE stream decodes.
arturobernalg
requested changes
Nov 21, 2026
arturobernalg
left a comment
Member
There was a problem hiding this comment.
Thanks for the fix. The infinite loop is addressed, but I think there is still an issue.
RFC 7692 §7.2.1 allows multiple DEFLATE blocks in a single message, including BFINAL=1 followed by additional blocks. The current implementation resets the Inflater without processing the remaining input, potentially truncating the message.
Could you cover this case, including fragmented messages, with a regression test?
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.
stop inflating in
PerMessageDeflateExtension.decodeonce the Inflater has finished and reset it there and inPerMessageDeflate, otherwise a frame ending in a BFINAL deflate block (RFC 7692 §7.2.3.4, e.g. the RFC's own 8-byteHelloexample) spins the server read thread in an infinite loop and the client decodes every later message as empty.