aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/ext
diff options
context:
space:
mode:
authorGravatar Nicolas Noble <nicolasnoble@users.noreply.github.com>2016-04-07 15:34:26 -0700
committerGravatar Nicolas Noble <nicolasnoble@users.noreply.github.com>2016-04-07 15:34:26 -0700
commit45603561556601fce3e516bffee1b98979c7b722 (patch)
treeb66c67e7449138cf83562cea09d14452a04a77b6 /src/core/ext
parentc236a213ee10f549d328840bc21c307eedd4b545 (diff)
parent1583d069557e4a8eadd5318e16433c1c09e2a66a (diff)
Merge pull request #6106 from ctiller/server_fix
Expand corpus, fix crash
Diffstat (limited to 'src/core/ext')
-rw-r--r--src/core/ext/transport/chttp2/transport/frame_data.c12
-rw-r--r--src/core/ext/transport/chttp2/transport/frame_data.h3
2 files changed, 9 insertions, 6 deletions
diff --git a/src/core/ext/transport/chttp2/transport/frame_data.c b/src/core/ext/transport/chttp2/transport/frame_data.c
index 9c301d1608..3a6d80e0a3 100644
--- a/src/core/ext/transport/chttp2/transport/frame_data.c
+++ b/src/core/ext/transport/chttp2/transport/frame_data.c
@@ -159,7 +159,10 @@ grpc_chttp2_parse_error grpc_chttp2_data_parser_parse(
}
switch (p->state) {
- fh_0:
+ case GRPC_CHTTP2_DATA_ERROR:
+ p->state = GRPC_CHTTP2_DATA_ERROR;
+ return GRPC_CHTTP2_STREAM_ERROR;
+ fh_0:
case GRPC_CHTTP2_DATA_FH_0:
stream_parsing->stats.incoming.framing_bytes++;
p->frame_type = *cur;
@@ -172,6 +175,7 @@ grpc_chttp2_parse_error grpc_chttp2_data_parser_parse(
break;
default:
gpr_log(GPR_ERROR, "Bad GRPC frame type 0x%02x", p->frame_type);
+ p->state = GRPC_CHTTP2_DATA_ERROR;
return GRPC_CHTTP2_STREAM_ERROR;
}
if (++cur == end) {
@@ -218,13 +222,11 @@ grpc_chttp2_parse_error grpc_chttp2_data_parser_parse(
message_flags, &p->incoming_frames);
/* fallthrough */
case GRPC_CHTTP2_DATA_FRAME:
+ grpc_chttp2_list_add_parsing_seen_stream(transport_parsing,
+ stream_parsing);
if (cur == end) {
- grpc_chttp2_list_add_parsing_seen_stream(transport_parsing,
- stream_parsing);
return GRPC_CHTTP2_PARSE_OK;
}
- grpc_chttp2_list_add_parsing_seen_stream(transport_parsing,
- stream_parsing);
uint32_t remaining = (uint32_t)(end - cur);
if (remaining == p->frame_size) {
stream_parsing->stats.incoming.data_bytes += p->frame_size;
diff --git a/src/core/ext/transport/chttp2/transport/frame_data.h b/src/core/ext/transport/chttp2/transport/frame_data.h
index 2ff32963d6..af71f483a2 100644
--- a/src/core/ext/transport/chttp2/transport/frame_data.h
+++ b/src/core/ext/transport/chttp2/transport/frame_data.h
@@ -49,7 +49,8 @@ typedef enum {
GRPC_CHTTP2_DATA_FH_2,
GRPC_CHTTP2_DATA_FH_3,
GRPC_CHTTP2_DATA_FH_4,
- GRPC_CHTTP2_DATA_FRAME
+ GRPC_CHTTP2_DATA_FRAME,
+ GRPC_CHTTP2_DATA_ERROR
} grpc_chttp2_stream_state;
typedef struct grpc_chttp2_incoming_byte_stream