Fix percent decode fuzzer

reviewable/pr17308/r1
yang-g 6 years ago
parent 47e5771181
commit b5966a281c
  1. 6
      test/core/slice/percent_decode_fuzzer.cc

@ -31,9 +31,8 @@ bool squelch = true;
bool leak_check = true; bool leak_check = true;
extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
struct grpc_memory_counters counters; grpc_core::testing::LeakDetector leak_detector(true);
grpc_init(); grpc_init();
grpc_memory_counters_init();
grpc_slice input = grpc_slice_from_copied_buffer((const char*)data, size); grpc_slice input = grpc_slice_from_copied_buffer((const char*)data, size);
grpc_slice output; grpc_slice output;
if (grpc_strict_percent_decode_slice( if (grpc_strict_percent_decode_slice(
@ -46,9 +45,6 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
} }
grpc_slice_unref(grpc_permissive_percent_decode_slice(input)); grpc_slice_unref(grpc_permissive_percent_decode_slice(input));
grpc_slice_unref(input); grpc_slice_unref(input);
counters = grpc_memory_counters_snapshot();
grpc_memory_counters_destroy();
grpc_shutdown(); grpc_shutdown();
GPR_ASSERT(counters.total_size_relative == 0);
return 0; return 0;
} }

Loading…
Cancel
Save