chromium/third_party/libprotobuf-mutator/src/src/libfuzzer/libfuzzer_mutator.cc

// Copyright 2017 Google Inc. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

#include "src/libfuzzer/libfuzzer_mutator.h"

#include <string.h>

#include <algorithm>
#include <cassert>
#include <memory>
#include <string>

#include "port/protobuf.h"
#include "src/mutator.h"

// see compiler-rt/lib/sanitizer-common/sanitizer_internal_defs.h; usage same as
// SANITIZER_INTERFACE_WEAK_DEF with some functionality removed
#ifdef _MSC_VER
#if defined(_M_IX86) || defined(__i386__)
#define WIN_SYM_PREFIX
#else
#define WIN_SYM_PREFIX
#endif

#define STRINGIFY_
#define STRINGIFY

#define WEAK_DEFAULT_NAME

// clang-format off
#define LIB_PROTO_MUTATOR_WEAK_DEF
// clang-format on
#else
#define LIB_PROTO_MUTATOR_WEAK_DEF(ReturnType, Name, ...)
#endif

LIB_PROTO_MUTATOR_WEAK_DEF(size_t, LLVMFuzzerMutate, uint8_t*, size_t, size_t) {}

namespace protobuf_mutator {
namespace libfuzzer {

namespace {

template <class T>
T MutateValue(T v) {}

}  // namespace

int32_t Mutator::MutateInt32(int32_t value) {}

int64_t Mutator::MutateInt64(int64_t value) {}

uint32_t Mutator::MutateUInt32(uint32_t value) {}

uint64_t Mutator::MutateUInt64(uint64_t value) {}

float Mutator::MutateFloat(float value) {}

double Mutator::MutateDouble(double value) {}

std::string Mutator::MutateString(const std::string& value,
                                  int size_increase_hint) {}

}  // namespace libfuzzer
}  // namespace protobuf_mutator