Reporting FRAME_SIZE_ERROR in case wrong frame lengths.

This commit is contained in:
Simone Bordet 2014-08-01 15:01:03 +02:00
parent 161bccda22
commit 168a8f7dbf
8 changed files with 18 additions and 18 deletions

View File

@ -87,7 +87,7 @@ public class DataBodyParser extends BodyParser
loop = length == 0;
if (length < 0)
{
return notifyConnectionFailure(ErrorCode.PROTOCOL_ERROR, "invalid_data_frame_padding");
return notifyConnectionFailure(ErrorCode.FRAME_SIZE_ERROR, "invalid_data_frame_padding");
}
break;
}

View File

@ -69,7 +69,7 @@ public class GoAwayBodyParser extends BodyParser
length -= 4;
if (length <= 0)
{
return notifyConnectionFailure(ErrorCode.PROTOCOL_ERROR, "invalid_go_away_frame");
return notifyConnectionFailure(ErrorCode.FRAME_SIZE_ERROR, "invalid_go_away_frame");
}
}
else
@ -87,7 +87,7 @@ public class GoAwayBodyParser extends BodyParser
--length;
if (cursor > 0 && length <= 0)
{
return notifyConnectionFailure(ErrorCode.PROTOCOL_ERROR, "invalid_go_away_frame");
return notifyConnectionFailure(ErrorCode.FRAME_SIZE_ERROR, "invalid_go_away_frame");
}
if (cursor == 0)
{
@ -95,7 +95,7 @@ public class GoAwayBodyParser extends BodyParser
state = State.ERROR;
if (length == 0)
{
return notifyConnectionFailure(ErrorCode.PROTOCOL_ERROR, "invalid_go_away_frame");
return notifyConnectionFailure(ErrorCode.FRAME_SIZE_ERROR, "invalid_go_away_frame");
}
}
break;
@ -109,7 +109,7 @@ public class GoAwayBodyParser extends BodyParser
length -= 4;
if (length < 0)
{
return notifyConnectionFailure(ErrorCode.PROTOCOL_ERROR, "invalid_go_away_frame");
return notifyConnectionFailure(ErrorCode.FRAME_SIZE_ERROR, "invalid_go_away_frame");
}
if (length == 0)
{
@ -131,7 +131,7 @@ public class GoAwayBodyParser extends BodyParser
--length;
if (cursor > 0 && length <= 0)
{
return notifyConnectionFailure(ErrorCode.PROTOCOL_ERROR, "invalid_go_away_frame");
return notifyConnectionFailure(ErrorCode.FRAME_SIZE_ERROR, "invalid_go_away_frame");
}
if (cursor == 0)
{

View File

@ -110,7 +110,7 @@ public class HeadersBodyParser extends BodyParser
loop = length == 0;
if (length < 0)
{
return notifyConnectionFailure(ErrorCode.PROTOCOL_ERROR, "invalid_headers_frame_padding");
return notifyConnectionFailure(ErrorCode.FRAME_SIZE_ERROR, "invalid_headers_frame_padding");
}
break;
}
@ -133,7 +133,7 @@ public class HeadersBodyParser extends BodyParser
state = State.WEIGHT;
if (length < 1)
{
return notifyConnectionFailure(ErrorCode.PROTOCOL_ERROR, "invalid_headers_frame");
return notifyConnectionFailure(ErrorCode.FRAME_SIZE_ERROR, "invalid_headers_frame");
}
}
else
@ -151,7 +151,7 @@ public class HeadersBodyParser extends BodyParser
--length;
if (cursor > 0 && length <= 0)
{
return notifyConnectionFailure(ErrorCode.PROTOCOL_ERROR, "invalid_headers_frame");
return notifyConnectionFailure(ErrorCode.FRAME_SIZE_ERROR, "invalid_headers_frame");
}
if (cursor == 0)
{
@ -159,7 +159,7 @@ public class HeadersBodyParser extends BodyParser
state = State.WEIGHT;
if (length < 1)
{
return notifyConnectionFailure(ErrorCode.PROTOCOL_ERROR, "invalid_headers_frame");
return notifyConnectionFailure(ErrorCode.FRAME_SIZE_ERROR, "invalid_headers_frame");
}
}
break;

View File

@ -59,7 +59,7 @@ public class PriorityBodyParser extends BodyParser
int length = getBodyLength();
if (length != 5)
{
return notifyConnectionFailure(ErrorCode.PROTOCOL_ERROR, "invalid_priority_frame");
return notifyConnectionFailure(ErrorCode.FRAME_SIZE_ERROR, "invalid_priority_frame");
}
state = State.EXCLUSIVE;
break;

View File

@ -90,7 +90,7 @@ public class PushPromiseBodyParser extends BodyParser
state = State.STREAM_ID;
if (length < 4)
{
return notifyConnectionFailure(ErrorCode.PROTOCOL_ERROR, "invalid_push_promise_frame");
return notifyConnectionFailure(ErrorCode.FRAME_SIZE_ERROR, "invalid_push_promise_frame");
}
break;
}
@ -119,7 +119,7 @@ public class PushPromiseBodyParser extends BodyParser
--length;
if (cursor > 0 && length <= 0)
{
return notifyConnectionFailure(ErrorCode.PROTOCOL_ERROR, "invalid_push_promise_frame");
return notifyConnectionFailure(ErrorCode.FRAME_SIZE_ERROR, "invalid_push_promise_frame");
}
if (cursor == 0)
{

View File

@ -57,7 +57,7 @@ public class ResetBodyParser extends BodyParser
int length = getBodyLength();
if (length != 4)
{
return notifyConnectionFailure(ErrorCode.PROTOCOL_ERROR, "invalid_rst_stream_frame");
return notifyConnectionFailure(ErrorCode.FRAME_SIZE_ERROR, "invalid_rst_stream_frame");
}
state = State.ERROR;
break;

View File

@ -83,7 +83,7 @@ public class SettingsBodyParser extends BodyParser
length -= 2;
if (length <= 0)
{
return notifyConnectionFailure(ErrorCode.PROTOCOL_ERROR, "invalid_settings_frame");
return notifyConnectionFailure(ErrorCode.FRAME_SIZE_ERROR, "invalid_settings_frame");
}
}
else
@ -102,7 +102,7 @@ public class SettingsBodyParser extends BodyParser
--length;
if (length <= 0)
{
return notifyConnectionFailure(ErrorCode.PROTOCOL_ERROR, "invalid_settings_frame");
return notifyConnectionFailure(ErrorCode.FRAME_SIZE_ERROR, "invalid_settings_frame");
}
if (cursor == 0)
{
@ -139,7 +139,7 @@ public class SettingsBodyParser extends BodyParser
--length;
if (cursor > 0 && length <= 0)
{
return notifyConnectionFailure(ErrorCode.PROTOCOL_ERROR, "invalid_settings_frame");
return notifyConnectionFailure(ErrorCode.FRAME_SIZE_ERROR, "invalid_settings_frame");
}
if (cursor == 0)
{

View File

@ -52,7 +52,7 @@ public class WindowUpdateBodyParser extends BodyParser
int length = getBodyLength();
if (length != 4)
{
return notifyConnectionFailure(ErrorCode.PROTOCOL_ERROR, "invalid_window_update_frame");
return notifyConnectionFailure(ErrorCode.FRAME_SIZE_ERROR, "invalid_window_update_frame");
}
state = State.WINDOW_DELTA;
break;