Skip to content

handle BFINAL deflate blocks in permessage-deflate decoders - #942

Open
Hsnmohd wants to merge 1 commit into
apache:masterfrom
Hsnmohd:permessage-deflate-bfinal
Open

Hsnmohd wants to merge 1 commit into
apache:masterfrom
Hsnmohd:permessage-deflate-bfinal

Conversation

@Hsnmohd

@Hsnmohd Hsnmohd commented Nov 15, 2026

Copy link
Copy Markdown
Contributor

stop inflating in PerMessageDeflateExtension.decode once the Inflater has finished and reset it there and in PerMessageDeflate, otherwise a frame ending in a BFINAL deflate block (RFC 7692 §7.2.3.4, e.g. the RFC's own 8-byte Hello example) spins the server read thread in an infinite loop and the client decodes every later message as empty.

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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants