• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright 2017 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 #include <string>
6 
7 #include "base/base64.h"
8 #include "base/logging.h"
9 #include "base/strings/string_piece.h"
10 
11 // Encode some random data, and then decode it.
LLVMFuzzerTestOneInput(const uint8_t * data,size_t size)12 extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
13   std::string encode_output;
14   std::string decode_output;
15   base::StringPiece data_piece(reinterpret_cast<const char*>(data), size);
16   base::Base64Encode(data_piece, &encode_output);
17   CHECK(base::Base64Decode(encode_output, &decode_output));
18   CHECK_EQ(data_piece, decode_output);
19   return 0;
20 }
21