h2 icon indicating copy to clipboard operation
h2 copied to clipboard

Handle malformed messages with continuation frames

Open carllerche opened this issue 6 years ago • 8 comments

When a HEADERS frame is received that is malformed, the stream is reset. However, any continuation frame that is received after that must still be have HPACK decoding performed in order to maintain the hpack state.

carllerche avatar Aug 25 '17 19:08 carllerche

It sounds bad to for our connection to grow inconsistent HPACK state. However, is the proper fix important enough for 0.1, or could we give ourselves time and simply return a connection error for now?

seanmonstar avatar Dec 18 '17 23:12 seanmonstar

It isn't an API breaking change, so technically it isn't a 0.1 hard requirement.

That said, I would be surprised if the real fix is much harder than a temporary fix.

carllerche avatar Dec 18 '17 23:12 carllerche

I believe that the solution is to add a new Ignore variant to this. Read the continuation frame & discard it.

And a test of course.

carllerche avatar Dec 19 '17 17:12 carllerche

Digging through, this is a bit more involved, but still not terribly hard. I'll try working on it.

carllerche avatar Dec 19 '17 17:12 carllerche

Looking at this, I discovered another potential issue #191.

carllerche avatar Dec 19 '17 18:12 carllerche

Also, the analysis of the fix is incorrect.

carllerche avatar Dec 19 '17 18:12 carllerche

I'm removing this from the 0.1 milestone. As @seanmonstar pointed out, this is not critical.

carllerche avatar Jan 03 '18 21:01 carllerche

I believe that the solution is to add a new Ignore variant to this. Read the continuation frame & discard it.

Link with a hash so it doesn't get outdated:

https://github.com/hyperium/h2/blob/04570652b75a2a5176fb296c0c8309a865dc9d79/src/codec/framed_read.rs#L46-L50

nox avatar May 06 '21 11:05 nox