Merge pull request #21433 from iposva-google/fuzzer-5686577615339520

Fix leak when running b64_encode_fuzzer tests.
pull/21447/head
Karthik Ravi Shankar 5 years ago committed by GitHub
commit 81481cb26b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 1
      test/core/slice/b64_encode_corpus/testcase-5686577615339520
  2. 6
      test/core/slice/b64_encode_fuzzer.cc

@ -19,6 +19,7 @@
#include <stdbool.h>
#include <stdint.h>
#include "include/grpc/support/alloc.h"
#include "src/core/lib/slice/b64.h"
bool squelch = true;
@ -28,7 +29,8 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
if (size < 2) return 0;
const bool url_safe = static_cast<uint8_t>(0x100) < data[0];
const bool multiline = static_cast<uint8_t>(0x100) < data[1];
grpc_base64_encode(reinterpret_cast<const char*>(data + 2), size - 2,
url_safe, multiline);
char* res = grpc_base64_encode(reinterpret_cast<const char*>(data + 2),
size - 2, url_safe, multiline);
gpr_free(res);
return 0;
}

Loading…
Cancel
Save