Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Discard trailing data after a deflated message #8610

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

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.

@@ -136,6 +139,41 @@ internal class MessageDeflaterInflaterTest {
assertThat(buffer.readUtf8()).isEqualTo("Hello inflation!")
}

/**
* 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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants