Skip to content
Snippets Groups Projects
Commit 9f483e33 authored by David G. Quintas's avatar David G. Quintas
Browse files

Merge pull request #4452 from ctiller/cf

clang-format after last weeks test-fest
parents f35f9257 620e965c
No related branches found
No related tags found
No related merge requests found
Showing
with 151 additions and 139 deletions
......@@ -41,9 +41,9 @@ extern "C" {
#endif
typedef struct gpr_allocation_functions {
void *(*malloc_fn)(size_t size);
void *(*realloc_fn)(void *ptr, size_t size);
void (*free_fn)(void *ptr);
void *(*malloc_fn)(size_t size);
void *(*realloc_fn)(void *ptr, size_t size);
void (*free_fn)(void *ptr);
} gpr_allocation_functions;
/* malloc, never returns NULL */
......
......@@ -41,7 +41,7 @@
/* census_context is the in-memory representation of information needed to
* maintain tracing, RPC statistics and resource usage information. */
struct census_context {
census_tag_set *tags; /* Opaque data structure for census tags. */
census_tag_set *tags; /* Opaque data structure for census tags. */
};
#endif /* GRPC_INTERNAL_CORE_CENSUS_CONTEXT_H */
......@@ -91,13 +91,11 @@ error:
return 0;
}
static void *zalloc_gpr(void* opaque, unsigned int items, unsigned int size) {
static void* zalloc_gpr(void* opaque, unsigned int items, unsigned int size) {
return gpr_malloc(items * size);
}
static void zfree_gpr(void* opaque, void *address) {
gpr_free(address);
}
static void zfree_gpr(void* opaque, void* address) { gpr_free(address); }
static int zlib_compress(gpr_slice_buffer* input, gpr_slice_buffer* output,
int gzip) {
......@@ -157,7 +155,7 @@ static int copy(gpr_slice_buffer* input, gpr_slice_buffer* output) {
}
static int compress_inner(grpc_compression_algorithm algorithm,
gpr_slice_buffer* input, gpr_slice_buffer* output) {
gpr_slice_buffer* input, gpr_slice_buffer* output) {
switch (algorithm) {
case GRPC_COMPRESS_NONE:
/* the fallback path always needs to be send uncompressed: we simply
......
......@@ -624,9 +624,8 @@ static void basic_pollset_destroy(grpc_pollset *pollset) {
}
static const grpc_pollset_vtable basic_pollset = {
basic_pollset_add_fd,
basic_pollset_maybe_work_and_unlock, basic_pollset_destroy,
basic_pollset_destroy};
basic_pollset_add_fd, basic_pollset_maybe_work_and_unlock,
basic_pollset_destroy, basic_pollset_destroy};
static void become_basic_pollset(grpc_pollset *pollset, grpc_fd *fd_or_null) {
pollset->vtable = &basic_pollset;
......
......@@ -197,7 +197,8 @@ static void win_read(grpc_exec_ctx *exec_ctx, grpc_endpoint *ep,
tcp->read_slice = gpr_slice_malloc(8192);
buffer.len = (ULONG)GPR_SLICE_LENGTH(tcp->read_slice); // we know slice size fits in 32bit.
buffer.len = (ULONG)GPR_SLICE_LENGTH(
tcp->read_slice); // we know slice size fits in 32bit.
buffer.buf = (char *)GPR_SLICE_START_PTR(tcp->read_slice);
TCP_REF(tcp, "read");
......@@ -291,7 +292,7 @@ static void win_write(grpc_exec_ctx *exec_ctx, grpc_endpoint *ep,
for (i = 0; i < tcp->write_slices->count; i++) {
len = GPR_SLICE_LENGTH(tcp->write_slices->slices[i]);
GPR_ASSERT(len <= ULONG_MAX);
buffers[i].len = (ULONG) len;
buffers[i].len = (ULONG)len;
buffers[i].buf = (char *)GPR_SLICE_START_PTR(tcp->write_slices->slices[i]);
}
......
......@@ -232,7 +232,7 @@ grpc_json_reader_status grpc_json_reader_run(grpc_json_reader *reader) {
reader->state = GRPC_JSON_STATE_END;
break;
default:
GPR_UNREACHABLE_CODE(return GRPC_JSON_INTERNAL_ERROR);
GPR_UNREACHABLE_CODE(return GRPC_JSON_INTERNAL_ERROR);
}
}
break;
......
......@@ -512,8 +512,9 @@ grpc_call_credentials *grpc_service_account_jwt_access_credentials_create(
"token_lifetime="
"gpr_timespec { tv_sec: %lld, tv_nsec: %d, clock_type: %d }, "
"reserved=%p)",
5, (json_key, (long long)token_lifetime.tv_sec, (int)token_lifetime.tv_nsec,
(int)token_lifetime.clock_type, reserved));
5,
(json_key, (long long)token_lifetime.tv_sec, (int)token_lifetime.tv_nsec,
(int)token_lifetime.clock_type, reserved));
GPR_ASSERT(reserved == NULL);
return grpc_service_account_jwt_access_credentials_create_from_auth_json_key(
grpc_auth_json_key_create_from_string(json_key), token_lifetime);
......
......@@ -47,7 +47,7 @@ static struct timespec timespec_from_gpr(gpr_timespec gts) {
struct timespec rv;
if (sizeof(time_t) < sizeof(gpr_int64)) {
/* fine to assert, as this is only used in gpr_sleep_until */
GPR_ASSERT(gts.tv_sec <= INT32_MAX && gts.tv_sec >= INT32_MIN);
GPR_ASSERT(gts.tv_sec <= INT32_MAX && gts.tv_sec >= INT32_MIN);
}
rv.tv_sec = (time_t)gts.tv_sec;
rv.tv_nsec = gts.tv_nsec;
......
......@@ -116,4 +116,3 @@ void grpc_call_log_batch(char *file, int line, gpr_log_severity severity,
gpr_free(tmp);
}
}
......@@ -198,8 +198,8 @@ grpc_call *grpc_channel_create_call(grpc_channel *channel,
"deadline=gpr_timespec { tv_sec: %lld, tv_nsec: %d, clock_type: %d }, "
"reserved=%p)",
10, (channel, parent_call, (unsigned)propagation_mask, cq, method, host,
(long long)deadline.tv_sec, (int)deadline.tv_nsec, (int)deadline.clock_type,
reserved));
(long long)deadline.tv_sec, (int)deadline.tv_nsec,
(int)deadline.clock_type, reserved));
GPR_ASSERT(!reserved);
return grpc_channel_create_call_internal(
channel, parent_call, propagation_mask, cq,
......@@ -242,8 +242,8 @@ grpc_call *grpc_channel_create_registered_call(
"deadline=gpr_timespec { tv_sec: %lld, tv_nsec: %d, clock_type: %d }, "
"reserved=%p)",
9, (channel, parent_call, (unsigned)propagation_mask, completion_queue,
registered_call_handle, (long long)deadline.tv_sec, (int)deadline.tv_nsec,
(int)deadline.clock_type, reserved));
registered_call_handle, (long long)deadline.tv_sec,
(int)deadline.tv_nsec, (int)deadline.clock_type, reserved));
GPR_ASSERT(!reserved);
return grpc_channel_create_call_internal(
channel, parent_call, propagation_mask, completion_queue,
......
......@@ -249,8 +249,8 @@ grpc_event grpc_completion_queue_next(grpc_completion_queue *cc,
"cc=%p, "
"deadline=gpr_timespec { tv_sec: %lld, tv_nsec: %d, clock_type: %d }, "
"reserved=%p)",
5, (cc, (long long)deadline.tv_sec, (int)deadline.tv_nsec, (int)deadline.clock_type,
reserved));
5, (cc, (long long)deadline.tv_sec, (int)deadline.tv_nsec,
(int)deadline.clock_type, reserved));
GPR_ASSERT(!reserved);
deadline = gpr_convert_clock_type(deadline, GPR_CLOCK_MONOTONIC);
......
......@@ -47,6 +47,5 @@ grpc_server *grpc_server_create(const grpc_channel_args *args, void *reserved) {
filters[num_filters++] = &grpc_server_census_filter;
}
GRPC_API_TRACE("grpc_server_create(%p, %p)", 2, (args, reserved));
return grpc_server_create_from_filters(filters, num_filters,
args);
return grpc_server_create_from_filters(filters, num_filters, args);
}
......@@ -118,7 +118,7 @@ void grpc_chttp2_encode_data(gpr_uint32 id, gpr_slice_buffer *inbuf,
hdr = gpr_slice_malloc(9);
p = GPR_SLICE_START_PTR(hdr);
GPR_ASSERT(write_bytes < (1<<24));
GPR_ASSERT(write_bytes < (1 << 24));
*p++ = (gpr_uint8)(write_bytes >> 16);
*p++ = (gpr_uint8)(write_bytes >> 8);
*p++ = (gpr_uint8)(write_bytes);
......
......@@ -44,7 +44,7 @@
#include "src/core/transport/chttp2/http2_errors.h"
#include "src/core/transport/chttp2_transport.h"
#define MAX_MAX_HEADER_LIST_SIZE (1024*1024*1024)
#define MAX_MAX_HEADER_LIST_SIZE (1024 * 1024 * 1024)
/* HTTP/2 mandated initial connection settings */
const grpc_chttp2_setting_parameters
......@@ -62,8 +62,9 @@ const grpc_chttp2_setting_parameters
GRPC_CHTTP2_FLOW_CONTROL_ERROR},
{"MAX_FRAME_SIZE", 16384, 16384, 16777215,
GRPC_CHTTP2_DISCONNECT_ON_INVALID_VALUE, GRPC_CHTTP2_PROTOCOL_ERROR},
{"MAX_HEADER_LIST_SIZE", MAX_MAX_HEADER_LIST_SIZE, 0, MAX_MAX_HEADER_LIST_SIZE,
GRPC_CHTTP2_CLAMP_INVALID_VALUE, GRPC_CHTTP2_PROTOCOL_ERROR},
{"MAX_HEADER_LIST_SIZE", MAX_MAX_HEADER_LIST_SIZE, 0,
MAX_MAX_HEADER_LIST_SIZE, GRPC_CHTTP2_CLAMP_INVALID_VALUE,
GRPC_CHTTP2_PROTOCOL_ERROR},
};
static gpr_uint8 *fill_header(gpr_uint8 *out, gpr_uint32 length,
......
......@@ -366,8 +366,9 @@ static void hpack_enc(grpc_chttp2_hpack_compressor *c, grpc_mdelem *elem,
if (GPR_SLICE_START_PTR(elem->key->slice)[0] != ':') { /* regular header */
st->seen_regular_header = 1;
} else {
GPR_ASSERT(st->seen_regular_header == 0 &&
"Reserved header (colon-prefixed) happening after regular ones.");
GPR_ASSERT(
st->seen_regular_header == 0 &&
"Reserved header (colon-prefixed) happening after regular ones.");
}
inc_filter(HASH_FRAGMENT_1(elem_hash), &c->filter_elems_sum, c->filter_elems);
......
......@@ -66,7 +66,8 @@ void grpc_chttp2_hpack_write_varint_tail(gpr_uint32 tail_value,
if ((length) == 1u) { \
(tgt)[0] = (gpr_uint8)((prefix_or) | (n)); \
} else { \
(tgt)[0] = (prefix_or) | (gpr_uint8)GRPC_CHTTP2_MAX_IN_PREFIX(prefix_bits); \
(tgt)[0] = \
(prefix_or) | (gpr_uint8)GRPC_CHTTP2_MAX_IN_PREFIX(prefix_bits); \
grpc_chttp2_hpack_write_varint_tail( \
(n)-GRPC_CHTTP2_MAX_IN_PREFIX(prefix_bits), (tgt) + 1, (length)-1); \
} \
......
......@@ -38,8 +38,8 @@
#include "test/core/end2end/cq_verifier.h"
#include "src/core/surface/server.h"
#define PFX_STR \
"PRI * HTTP/2.0\r\n\r\nSM\r\n\r\n" \
#define PFX_STR \
"PRI * HTTP/2.0\r\n\r\nSM\r\n\r\n" \
"\x00\x00\x00\x04\x00\x00\x00\x00\x00" /* settings frame */
static void verifier(grpc_server *server, grpc_completion_queue *cq) {
......@@ -54,76 +54,86 @@ int main(int argc, char **argv) {
grpc_test_init(argc, argv);
/* invalid content type */
GRPC_RUN_BAD_CLIENT_TEST(verifier,
PFX_STR
"\x00\x00\xc2\x01\x04\x00\x00\x00\x01"
"\x10\x05:path\x08/foo/bar"
"\x10\x07:scheme\x04http"
"\x10\x07:method\x04POST"
"\x10\x0a:authority\x09localhost"
"\x10\x0c""content-type\x09text/html"
"\x10\x14grpc-accept-encoding\x15identity,deflate,gzip"
"\x10\x02te\x08trailers"
"\x10\x0auser-agent\"bad-client grpc-c/0.12.0.0 (linux)",
GRPC_BAD_CLIENT_DISCONNECT);
GRPC_RUN_BAD_CLIENT_TEST(
verifier, PFX_STR
"\x00\x00\xc2\x01\x04\x00\x00\x00\x01"
"\x10\x05:path\x08/foo/bar"
"\x10\x07:scheme\x04http"
"\x10\x07:method\x04POST"
"\x10\x0a:authority\x09localhost"
"\x10\x0c"
"content-type\x09text/html"
"\x10\x14grpc-accept-encoding\x15identity,deflate,gzip"
"\x10\x02te\x08trailers"
"\x10\x0auser-agent\"bad-client grpc-c/0.12.0.0 (linux)",
GRPC_BAD_CLIENT_DISCONNECT);
/* invalid te */
GRPC_RUN_BAD_CLIENT_TEST(verifier,
PFX_STR
"\x00\x00\xcb\x01\x04\x00\x00\x00\x01"
"\x10\x05:path\x08/foo/bar"
"\x10\x07:scheme\x04http"
"\x10\x07:method\x04POST"
"\x10\x0a:authority\x09localhost"
"\x10\x0c""content-type\x10""application/grpc"
"\x10\x14grpc-accept-encoding\x15identity,deflate,gzip"
"\x10\x02te\x0a""frobnicate"
"\x10\x0auser-agent\"bad-client grpc-c/0.12.0.0 (linux)",
GRPC_BAD_CLIENT_DISCONNECT);
GRPC_RUN_BAD_CLIENT_TEST(
verifier, PFX_STR
"\x00\x00\xcb\x01\x04\x00\x00\x00\x01"
"\x10\x05:path\x08/foo/bar"
"\x10\x07:scheme\x04http"
"\x10\x07:method\x04POST"
"\x10\x0a:authority\x09localhost"
"\x10\x0c"
"content-type\x10"
"application/grpc"
"\x10\x14grpc-accept-encoding\x15identity,deflate,gzip"
"\x10\x02te\x0a"
"frobnicate"
"\x10\x0auser-agent\"bad-client grpc-c/0.12.0.0 (linux)",
GRPC_BAD_CLIENT_DISCONNECT);
/* two path headers */
GRPC_RUN_BAD_CLIENT_TEST(verifier,
PFX_STR
"\x00\x00\xd9\x01\x04\x00\x00\x00\x01"
"\x10\x05:path\x08/foo/bar"
"\x10\x05:path\x08/foo/bah"
"\x10\x07:scheme\x04http"
"\x10\x07:method\x04POST"
"\x10\x0a:authority\x09localhost"
"\x10\x0c""content-type\x10""application/grpc"
"\x10\x14grpc-accept-encoding\x15identity,deflate,gzip"
"\x10\x02te\x08trailers"
"\x10\x0auser-agent\"bad-client grpc-c/0.12.0.0 (linux)",
GRPC_BAD_CLIENT_DISCONNECT);
GRPC_RUN_BAD_CLIENT_TEST(
verifier, PFX_STR
"\x00\x00\xd9\x01\x04\x00\x00\x00\x01"
"\x10\x05:path\x08/foo/bar"
"\x10\x05:path\x08/foo/bah"
"\x10\x07:scheme\x04http"
"\x10\x07:method\x04POST"
"\x10\x0a:authority\x09localhost"
"\x10\x0c"
"content-type\x10"
"application/grpc"
"\x10\x14grpc-accept-encoding\x15identity,deflate,gzip"
"\x10\x02te\x08trailers"
"\x10\x0auser-agent\"bad-client grpc-c/0.12.0.0 (linux)",
GRPC_BAD_CLIENT_DISCONNECT);
/* bad accept-encoding algorithm */
GRPC_RUN_BAD_CLIENT_TEST(verifier,
PFX_STR
"\x00\x00\xd2\x01\x04\x00\x00\x00\x01"
"\x10\x05:path\x08/foo/bar"
"\x10\x07:scheme\x04http"
"\x10\x07:method\x04POST"
"\x10\x0a:authority\x09localhost"
"\x10\x0c""content-type\x10""application/grpc"
"\x10\x14grpc-accept-encoding\x1enobody-knows-the-trouble-i-see"
"\x10\x02te\x08trailers"
"\x10\x0auser-agent\"bad-client grpc-c/0.12.0.0 (linux)",
GRPC_BAD_CLIENT_DISCONNECT);
GRPC_RUN_BAD_CLIENT_TEST(
verifier, PFX_STR
"\x00\x00\xd2\x01\x04\x00\x00\x00\x01"
"\x10\x05:path\x08/foo/bar"
"\x10\x07:scheme\x04http"
"\x10\x07:method\x04POST"
"\x10\x0a:authority\x09localhost"
"\x10\x0c"
"content-type\x10"
"application/grpc"
"\x10\x14grpc-accept-encoding\x1enobody-knows-the-trouble-i-see"
"\x10\x02te\x08trailers"
"\x10\x0auser-agent\"bad-client grpc-c/0.12.0.0 (linux)",
GRPC_BAD_CLIENT_DISCONNECT);
/* bad grpc-encoding algorithm */
GRPC_RUN_BAD_CLIENT_TEST(verifier,
PFX_STR
"\x00\x00\xf5\x01\x04\x00\x00\x00\x01"
"\x10\x05:path\x08/foo/bar"
"\x10\x07:scheme\x04http"
"\x10\x07:method\x04POST"
"\x10\x0a:authority\x09localhost"
"\x10\x0c""content-type\x10""application/grpc"
"\x10\x14grpc-accept-encoding\x15identity,deflate,gzip"
"\x10\x0dgrpc-encoding\x1cyou-dont-know-how-to-do-this"
"\x10\x02te\x08trailers"
"\x10\x0auser-agent\"bad-client grpc-c/0.12.0.0 (linux)",
GRPC_BAD_CLIENT_DISCONNECT);
GRPC_RUN_BAD_CLIENT_TEST(
verifier, PFX_STR
"\x00\x00\xf5\x01\x04\x00\x00\x00\x01"
"\x10\x05:path\x08/foo/bar"
"\x10\x07:scheme\x04http"
"\x10\x07:method\x04POST"
"\x10\x0a:authority\x09localhost"
"\x10\x0c"
"content-type\x10"
"application/grpc"
"\x10\x14grpc-accept-encoding\x15identity,deflate,gzip"
"\x10\x0dgrpc-encoding\x1cyou-dont-know-how-to-do-this"
"\x10\x02te\x08trailers"
"\x10\x0auser-agent\"bad-client grpc-c/0.12.0.0 (linux)",
GRPC_BAD_CLIENT_DISCONNECT);
return 0;
}
......@@ -40,9 +40,9 @@
static void verifier(grpc_server *server, grpc_completion_queue *cq) {
while (grpc_server_has_open_connections(server)) {
GPR_ASSERT(grpc_completion_queue_next(
cq, GRPC_TIMEOUT_MILLIS_TO_DEADLINE(20), NULL)
.type == GRPC_QUEUE_TIMEOUT);
GPR_ASSERT(grpc_completion_queue_next(cq,
GRPC_TIMEOUT_MILLIS_TO_DEADLINE(20),
NULL).type == GRPC_QUEUE_TIMEOUT);
}
}
......@@ -126,24 +126,29 @@ int main(int argc, char **argv) {
0);
GRPC_RUN_BAD_CLIENT_TEST(verifier, PFX_STR
"\x00\x00\x04\x01\x04\x00\x00\x00\x01"
"\x7f\x7f\x01""a",
"\x7f\x7f\x01"
"a",
0);
GRPC_RUN_BAD_CLIENT_TEST(verifier, PFX_STR
"\x00\x00\x04\x01\x04\x00\x00\x00\x01"
"\x0f\x7f\x01""a",
"\x0f\x7f\x01"
"a",
0);
GRPC_RUN_BAD_CLIENT_TEST(verifier, PFX_STR
"\x00\x00\x04\x01\x04\x00\x00\x00\x01"
"\x1f\x7f\x01""a",
"\x1f\x7f\x01"
"a",
0);
/* test nvr, not indexed in static table */
GRPC_RUN_BAD_CLIENT_TEST(verifier, PFX_STR
"\x00\x00\x03\x01\x04\x00\x00\x00\x01"
"\x01\x01""a",
"\x01\x01"
"a",
GRPC_BAD_CLIENT_DISCONNECT);
GRPC_RUN_BAD_CLIENT_TEST(verifier, PFX_STR
"\x00\x00\x03\x01\x04\x00\x00\x00\x01"
"\x11\x01""a",
"\x11\x01"
"a",
GRPC_BAD_CLIENT_DISCONNECT);
/* illegal op code */
GRPC_RUN_BAD_CLIENT_TEST(verifier, PFX_STR
......@@ -228,14 +233,12 @@ int main(int argc, char **argv) {
GRPC_BAD_CLIENT_DISCONNECT);
/* dynamic table size update: set to default */
GRPC_RUN_BAD_CLIENT_TEST(verifier,
PFX_STR
GRPC_RUN_BAD_CLIENT_TEST(verifier, PFX_STR
"\x00\x00\x03\x01\x04\x00\x00\x00\x01"
"\x3f\xe1\x1f",
GRPC_BAD_CLIENT_DISCONNECT);
/* dynamic table size update: set too large */
GRPC_RUN_BAD_CLIENT_TEST(verifier,
PFX_STR
GRPC_RUN_BAD_CLIENT_TEST(verifier, PFX_STR
"\x00\x00\x03\x01\x04\x00\x00\x00\x01"
"\x3f\xf1\x1f",
0);
......@@ -251,42 +254,35 @@ int main(int argc, char **argv) {
0);
/* non-ending header followed by continuation frame */
GRPC_RUN_BAD_CLIENT_TEST(verifier,
PFX_STR
GRPC_RUN_BAD_CLIENT_TEST(verifier, PFX_STR
"\x00\x00\x00\x01\x00\x00\x00\x00\x01"
"\x00\x00\x00\x09\x04\x00\x00\x00\x01",
GRPC_BAD_CLIENT_DISCONNECT);
/* non-ending header followed by non-continuation frame */
GRPC_RUN_BAD_CLIENT_TEST(verifier,
PFX_STR
GRPC_RUN_BAD_CLIENT_TEST(verifier, PFX_STR
"\x00\x00\x00\x01\x00\x00\x00\x00\x01"
"\x00\x00\x00\x00\x04\x00\x00\x00\x01",
0);
/* non-ending header followed by a continuation frame for a different stream */
GRPC_RUN_BAD_CLIENT_TEST(verifier,
PFX_STR
/* non-ending header followed by a continuation frame for a different stream
*/
GRPC_RUN_BAD_CLIENT_TEST(verifier, PFX_STR
"\x00\x00\x00\x01\x04\x00\x00\x00\x01"
"\x00\x00\x00\x01\x00\x00\x00\x00\x03"
"\x00\x00\x00\x09\x04\x00\x00\x00\x01",
0);
/* opening with a continuation frame */
GRPC_RUN_BAD_CLIENT_TEST(verifier,
PFX_STR
"\x00\x00\x00\x09\x04\x00\x00\x00\x01",
0);
PFX_STR "\x00\x00\x00\x09\x04\x00\x00\x00\x01", 0);
/* three header frames */
GRPC_RUN_BAD_CLIENT_TEST(verifier,
PFX_STR
GRPC_RUN_BAD_CLIENT_TEST(verifier, PFX_STR
"\x00\x00\x00\x01\x04\x00\x00\x00\x01"
"\x00\x00\x00\x01\x04\x00\x00\x00\x01"
"\x00\x00\x00\x01\x04\x00\x00\x00\x01",
GRPC_BAD_CLIENT_DISCONNECT);
/* an invalid header found with fuzzing */
GRPC_RUN_BAD_CLIENT_TEST(verifier,
PFX_STR
"\x00\x00\x00\x01\x39\x67\xed\x1d\x64",
PFX_STR "\x00\x00\x00\x01\x39\x67\xed\x1d\x64",
GRPC_BAD_CLIENT_DISCONNECT);
/* a badly encoded timeout value */
......
......@@ -97,24 +97,23 @@ int main(int argc, char **argv) {
PFX_STR ONE_SETTING_HDR "\x00\x05\x00\x00\x00\x00",
GRPC_BAD_CLIENT_DISCONNECT);
GRPC_RUN_BAD_CLIENT_TEST(verifier,
PFX_STR ONE_SETTING_HDR "\x00\x06\xff\xff\xff\xff",
PFX_STR ONE_SETTING_HDR "\x00\x06\xff\xff\xff\xff",
GRPC_BAD_CLIENT_DISCONNECT);
/* update intiial window size */
GRPC_RUN_BAD_CLIENT_TEST(verifier,
PFX_STR ONE_SETTING_HDR "\x00\x04\x00\x01\x00\x00",
PFX_STR ONE_SETTING_HDR "\x00\x04\x00\x01\x00\x00",
GRPC_BAD_CLIENT_DISCONNECT);
/* ack with data */
GRPC_RUN_BAD_CLIENT_TEST(verifier,
PFX_STR
GRPC_RUN_BAD_CLIENT_TEST(verifier, PFX_STR
"\x00\x00\x00\x04\x00\x00\x00\x00\x00"
"\x00\x00\x01\x04\x01\x00\x00\x00\x00", 0);
"\x00\x00\x01\x04\x01\x00\x00\x00\x00",
0);
/* settings frame with invalid flags */
GRPC_RUN_BAD_CLIENT_TEST(verifier,
PFX_STR
"\x00\x00\x00\x04\x10\x00\x00\x00\x00", 0);
PFX_STR "\x00\x00\x00\x04\x10\x00\x00\x00\x00", 0);
/* unknown settings should be ignored */
GRPC_RUN_BAD_CLIENT_TEST(verifier,
PFX_STR ONE_SETTING_HDR "\x00\x99\x00\x00\x00\x00",
PFX_STR ONE_SETTING_HDR "\x00\x99\x00\x00\x00\x00",
GRPC_BAD_CLIENT_DISCONNECT);
return 0;
......
......@@ -51,7 +51,8 @@
"\x10\x0c" \
"content-type\x10" \
"application/grpc" \
"\x10\x14grpc-accept-encoding\x15""deflate,identity,gzip" \
"\x10\x14grpc-accept-encoding\x15" \
"deflate,identity,gzip" \
"\x10\x02te\x08trailers" \
"\x10\x0auser-agent\"bad-client grpc-c/0.12.0.0 (linux)"
......@@ -65,12 +66,16 @@
"\x10\x07:scheme\x04http" \
"\x10\x07:method\x04POST" \
"\x10\x04host\x09localhost" \
"\x10\x0c""content-type\x1e""application/grpc+this-is-valid" \
"\x10\x0c" \
"content-type\x1e" \
"application/grpc+this-is-valid" \
"\x10\x14grpc-accept-encoding\x15identity,deflate,gzip" \
"\x10\x02te\x08trailers" \
"\x10\x0auser-agent\"bad-client grpc-c/0.12.0.0 (linux)" \
"\x10\x0cgrpc-timeout\x03""10S" \
"\x10\x0cgrpc-timeout\x02""5S"
"\x10\x0cgrpc-timeout\x03" \
"10S" \
"\x10\x0cgrpc-timeout\x02" \
"5S"
static void *tag(gpr_intptr t) { return (void *)t; }
......@@ -130,8 +135,10 @@ int main(int argc, char **argv) {
GRPC_RUN_BAD_CLIENT_TEST(failure_verifier,
PFX_STR "\x00\x00\x00\x08\x10\x00\x00\x00\x01", 0);
/* push a window update with bad data */
GRPC_RUN_BAD_CLIENT_TEST(failure_verifier,
PFX_STR "\x00\x00\x04\x08\x00\x00\x00\x00\x01" "\xff\xff\xff\xff", 0);
GRPC_RUN_BAD_CLIENT_TEST(failure_verifier, PFX_STR
"\x00\x00\x04\x08\x00\x00\x00\x00\x01"
"\xff\xff\xff\xff",
0);
/* push a short goaway */
GRPC_RUN_BAD_CLIENT_TEST(failure_verifier,
PFX_STR "\x00\x00\x04\x07\x00\x00\x00\x00\x00", 0);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment