Skip to content
Snippets Groups Projects
Commit 004a8193 authored by Craig Tiller's avatar Craig Tiller
Browse files

Fix bugs in api_fuzzer

parent fd0e2152
No related branches found
No related tags found
No related merge requests found
Showing
with 7 additions and 23 deletions
...@@ -604,12 +604,12 @@ static call_state *maybe_delete_call_state(call_state *call) { ...@@ -604,12 +604,12 @@ static call_state *maybe_delete_call_state(call_state *call) {
grpc_slice_unref(call->recv_status_details); grpc_slice_unref(call->recv_status_details);
grpc_call_details_destroy(&call->call_details); grpc_call_details_destroy(&call->call_details);
for (size_t i = 0; i < call->num_to_free; i++) {
gpr_free(call->to_free[i]);
}
for (size_t i = 0; i < call->num_slices_to_unref; i++) { for (size_t i = 0; i < call->num_slices_to_unref; i++) {
grpc_slice_unref(call->slices_to_unref[i]); grpc_slice_unref(call->slices_to_unref[i]);
} }
for (size_t i = 0; i < call->num_to_free; i++) {
gpr_free(call->to_free[i]);
}
gpr_free(call->to_free); gpr_free(call->to_free);
gpr_free(call->slices_to_unref); gpr_free(call->slices_to_unref);
...@@ -627,7 +627,7 @@ static void add_to_free(call_state *call, void *p) { ...@@ -627,7 +627,7 @@ static void add_to_free(call_state *call, void *p) {
call->to_free[call->num_to_free++] = p; call->to_free[call->num_to_free++] = p;
} }
static grpc_slice *add_to_slice_unref(call_state *call, grpc_slice s) { static grpc_slice *add_slice_to_unref(call_state *call, grpc_slice s) {
if (call->num_slices_to_unref == call->cap_slices_to_unref) { if (call->num_slices_to_unref == call->cap_slices_to_unref) {
call->cap_slices_to_unref = GPR_MAX(8, 2 * call->cap_slices_to_unref); call->cap_slices_to_unref = GPR_MAX(8, 2 * call->cap_slices_to_unref);
call->slices_to_unref = call->slices_to_unref =
...@@ -648,8 +648,8 @@ static void read_metadata(input_stream *inp, size_t *count, ...@@ -648,8 +648,8 @@ static void read_metadata(input_stream *inp, size_t *count,
(*metadata)[i].key = read_string_like_slice(inp); (*metadata)[i].key = read_string_like_slice(inp);
(*metadata)[i].value = read_buffer_like_slice(inp); (*metadata)[i].value = read_buffer_like_slice(inp);
(*metadata)[i].flags = read_uint32(inp); (*metadata)[i].flags = read_uint32(inp);
add_to_slice_unref(cs, (*metadata)[i].key); add_slice_to_unref(cs, (*metadata)[i].key);
add_to_slice_unref(cs, (*metadata)[i].value); add_slice_to_unref(cs, (*metadata)[i].value);
} }
} else { } else {
*metadata = gpr_malloc(1); *metadata = gpr_malloc(1);
...@@ -1008,7 +1008,7 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) { ...@@ -1008,7 +1008,7 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
g_active_call); g_active_call);
op->data.send_status_from_server.status = next_byte(&inp); op->data.send_status_from_server.status = next_byte(&inp);
op->data.send_status_from_server.status_details = op->data.send_status_from_server.status_details =
add_to_slice_unref(g_active_call, add_slice_to_unref(g_active_call,
read_buffer_like_slice(&inp)); read_buffer_like_slice(&inp));
break; break;
case GRPC_OP_RECV_INITIAL_METADATA: case GRPC_OP_RECV_INITIAL_METADATA:
...@@ -1056,22 +1056,6 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) { ...@@ -1056,22 +1056,6 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
grpc_byte_buffer_destroy(g_active_call->send_message); grpc_byte_buffer_destroy(g_active_call->send_message);
g_active_call->send_message = NULL; g_active_call->send_message = NULL;
} }
for (i = 0; i < num_ops; i++) {
op = &ops[i];
switch (op->op) {
case GRPC_OP_SEND_STATUS_FROM_SERVER:
gpr_free((void *)op->data.send_status_from_server.status_details);
break;
case GRPC_OP_SEND_MESSAGE:
case GRPC_OP_SEND_INITIAL_METADATA:
case GRPC_OP_SEND_CLOSE_FROM_CLIENT:
case GRPC_OP_RECV_INITIAL_METADATA:
case GRPC_OP_RECV_MESSAGE:
case GRPC_OP_RECV_STATUS_ON_CLIENT:
case GRPC_OP_RECV_CLOSE_ON_SERVER:
break;
}
}
gpr_free(ops); gpr_free(ops);
break; break;
......
File added
File added
File added
File added
File added
File added
File added
File added
File added
File added
File added
File added
File added
File added
File added
File added
File added
File added
File added
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment