Skip to content

Conversation

@swankjesse
Copy link
Collaborator

We can recover from this and it seems like the least worst of our options.

Closes: #8551

We can recover from this and it seems like the least worst of our
options.

Closes: #8551
if (inflater.bytesRead < totalBytesToRead) {
deflatedBytes.clear()
inflaterSource.close()
this.inflaterSource = null
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I’m gonna claim it’s really weird if you have a stream-terminating message followed by another message and noContextTakeover = false. But perhaps I should write a test for this? I’m not exactly sure what reasonable behavior is.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also - I think the server in the case we’re addressing here is probably buggy. We might be better to follow @Fischiii’s lead and just reject the bogus data.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that was my change to make his PR pass

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@swankjesse @yschimke in case it helps. The server used is a Kestrel (.net version 7) with the WebsocketSharp.Standard2 Framework for the WebwSocket connection. Data transferred is binary form Protobuffer.

}

/**
* It's possible a self-terminating deflated message will contain trailing data that won't be
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it worth tying this back to the padding bytes in the spec?

@yschimke yschimke merged commit 8f88fdb into master Sep 21, 2025
25 checks passed
@yschimke yschimke deleted the jwilson.1206.deflater branch September 21, 2025 06:26
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.

deflatedBytes is not empty when inflate is called in MessageInflater

4 participants