diff options
author | Craig Tiller <ctiller@google.com> | 2016-04-06 16:53:40 -0700 |
---|---|---|
committer | Craig Tiller <ctiller@google.com> | 2016-04-06 16:53:40 -0700 |
commit | a385b385e5ef19a3f7a0dde2648a614ff265d2de (patch) | |
tree | f5c5edcacd54f3c1e9b86eb32a7f32556ed0beb9 /src/core/ext/transport | |
parent | 2879aa1b1db9a72299c62cb9e9f2aa74e3e3e762 (diff) |
Expand corpus, fix crash
Diffstat (limited to 'src/core/ext/transport')
-rw-r--r-- | src/core/ext/transport/chttp2/transport/frame_data.c | 10 | ||||
-rw-r--r-- | src/core/ext/transport/chttp2/transport/frame_data.h | 3 |
2 files changed, 8 insertions, 5 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..1995ad66e3 100644 --- a/src/core/ext/transport/chttp2/transport/frame_data.c +++ b/src/core/ext/transport/chttp2/transport/frame_data.c @@ -159,6 +159,9 @@ grpc_chttp2_parse_error grpc_chttp2_data_parser_parse( } switch (p->state) { + 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++; @@ -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 |