Added checks on the validity of the streamId.
This commit is contained in:
parent
7613385578
commit
907d303774
|
@ -62,6 +62,11 @@ public class DataBodyParser extends BodyParser
|
||||||
{
|
{
|
||||||
case PREPARE:
|
case PREPARE:
|
||||||
{
|
{
|
||||||
|
// SPEC: wrong streamId is treated as connection error.
|
||||||
|
if (getStreamId() == 0)
|
||||||
|
{
|
||||||
|
return notifyConnectionFailure(ErrorCode.PROTOCOL_ERROR, "invalid_data_frame");
|
||||||
|
}
|
||||||
length = getBodyLength();
|
length = getBodyLength();
|
||||||
if (isPaddingHigh())
|
if (isPaddingHigh())
|
||||||
{
|
{
|
||||||
|
|
|
@ -73,6 +73,11 @@ public class HeadersBodyParser extends BodyParser
|
||||||
{
|
{
|
||||||
case PREPARE:
|
case PREPARE:
|
||||||
{
|
{
|
||||||
|
// SPEC: wrong streamId is treated as connection error.
|
||||||
|
if (getStreamId() == 0)
|
||||||
|
{
|
||||||
|
return notifyConnectionFailure(ErrorCode.PROTOCOL_ERROR, "invalid_headers_frame");
|
||||||
|
}
|
||||||
length = getBodyLength();
|
length = getBodyLength();
|
||||||
if (isPaddingHigh())
|
if (isPaddingHigh())
|
||||||
{
|
{
|
||||||
|
|
|
@ -51,6 +51,11 @@ public class PriorityBodyParser extends BodyParser
|
||||||
{
|
{
|
||||||
case PREPARE:
|
case PREPARE:
|
||||||
{
|
{
|
||||||
|
// SPEC: wrong streamId is treated as connection error.
|
||||||
|
if (getStreamId() == 0)
|
||||||
|
{
|
||||||
|
return notifyConnectionFailure(ErrorCode.PROTOCOL_ERROR, "invalid_priority_frame");
|
||||||
|
}
|
||||||
int length = getBodyLength();
|
int length = getBodyLength();
|
||||||
if (length != 5)
|
if (length != 5)
|
||||||
{
|
{
|
||||||
|
|
|
@ -49,6 +49,11 @@ public class ResetBodyParser extends BodyParser
|
||||||
{
|
{
|
||||||
case PREPARE:
|
case PREPARE:
|
||||||
{
|
{
|
||||||
|
// SPEC: wrong streamId is treated as connection error.
|
||||||
|
if (getStreamId() == 0)
|
||||||
|
{
|
||||||
|
return notifyConnectionFailure(ErrorCode.PROTOCOL_ERROR, "invalid_rst_stream_frame");
|
||||||
|
}
|
||||||
int length = getBodyLength();
|
int length = getBodyLength();
|
||||||
if (length != 4)
|
if (length != 4)
|
||||||
{
|
{
|
||||||
|
|
|
@ -64,6 +64,11 @@ public class SettingsBodyParser extends BodyParser
|
||||||
{
|
{
|
||||||
case PREPARE:
|
case PREPARE:
|
||||||
{
|
{
|
||||||
|
// SPEC: wrong streamId is treated as connection error.
|
||||||
|
if (getStreamId() != 0)
|
||||||
|
{
|
||||||
|
return notifyConnectionFailure(ErrorCode.PROTOCOL_ERROR, "invalid_settings_frame");
|
||||||
|
}
|
||||||
length = getBodyLength();
|
length = getBodyLength();
|
||||||
settings = new HashMap<>();
|
settings = new HashMap<>();
|
||||||
state = State.SETTING_ID;
|
state = State.SETTING_ID;
|
||||||
|
|
Loading…
Reference in New Issue