#4855 fix race condition that can sometimes make H2 stream send an improper reset with cancel error code instead of protocol error code when the client sends more data than the content-length header specifies

Signed-off-by: Ludovic Orban <lorban@bitronix.be>
This commit is contained in:
Ludovic Orban 2020-06-09 16:59:49 +02:00
parent 56bda1b3ae
commit 714a9204b3
1 changed files with 1 additions and 1 deletions

View File

@ -320,7 +320,7 @@ public class HTTP2Stream extends IdleTimeout implements IStream, Callback, Dumpa
if (dataLength != Long.MIN_VALUE) if (dataLength != Long.MIN_VALUE)
{ {
dataLength -= frame.remaining(); dataLength -= frame.remaining();
if (frame.isEndStream() && dataLength != 0) if (dataLength < 0 || (frame.isEndStream() && dataLength != 0))
{ {
reset(new ResetFrame(streamId, ErrorCode.PROTOCOL_ERROR.code), Callback.NOOP); reset(new ResetFrame(streamId, ErrorCode.PROTOCOL_ERROR.code), Callback.NOOP);
callback.failed(new IOException("invalid_data_length")); callback.failed(new IOException("invalid_data_length"));