fix h2 bug found via fuzzing

This commit is contained in:
Maximilian Hils 2021-06-14 12:35:08 +02:00
parent 76f0b8f65e
commit fb625c6868
2 changed files with 5 additions and 0 deletions

View File

@ -65,6 +65,8 @@ class Http2Connection(HttpConnection):
stream is not None stream is not None
and and
stream.state_machine.state is not h2.stream.StreamState.CLOSED stream.state_machine.state is not h2.stream.StreamState.CLOSED
and
self.h2_conn.state_machine.state is not h2.connection.ConnectionState.CLOSED
): ):
return False return False
else: else:
@ -79,6 +81,8 @@ class Http2Connection(HttpConnection):
stream.state_machine.state is not h2.stream.StreamState.HALF_CLOSED_LOCAL stream.state_machine.state is not h2.stream.StreamState.HALF_CLOSED_LOCAL
and and
stream.state_machine.state is not h2.stream.StreamState.CLOSED stream.state_machine.state is not h2.stream.StreamState.CLOSED
and
self.h2_conn.state_machine.state is not h2.connection.ConnectionState.CLOSED
): ):
return True return True
else: else:

View File

@ -236,6 +236,7 @@ def _h2_request(chunks):
@example([ @example([
b'\x00\x00%\x01\x04\x00\x00\x00\x01A\x8b/\x91\xd3]\x05\\\x87\xa6\xe3M3\x84\x86\x82`\x85\x94\xe7\x8c~\xfff\x88/\x91' b'\x00\x00%\x01\x04\x00\x00\x00\x01A\x8b/\x91\xd3]\x05\\\x87\xa6\xe3M3\x84\x86\x82`\x85\x94\xe7\x8c~\xfff\x88/\x91'
b'\xd3]\x05\\\x87\xa7\\\x82h_\x00\x00\x07\x01\x05\x00\x00\x00\x01\xc1\x84\x86\x82\xc0\xbf\xbe']) b'\xd3]\x05\\\x87\xa7\\\x82h_\x00\x00\x07\x01\x05\x00\x00\x00\x01\xc1\x84\x86\x82\xc0\xbf\xbe'])
@example([b'\x00\x00\x03\x01\x04\x00\x00\x00\x01\x84\x86\x82\x00\x00\x08\x07\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'])
def test_fuzz_h2_request_chunks(chunks): def test_fuzz_h2_request_chunks(chunks):
_h2_request(chunks) _h2_request(chunks)