blob: d579466cef57cc2b2621a331d3d5942ece17ed51 [file] [log] [blame]
Lutz Justen70496c12019-07-24 11:11:55 +02001// Copyright 2019 The Chromium OS 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
Felipe Andradea0cbde72020-04-01 15:40:10 +02005#include "kerberos/config_parser.h"
Manoj Guptafc4482c2019-09-20 13:43:02 -07006#include "kerberos/krb5_interface_impl.h"
Lutz Justen70496c12019-07-24 11:11:55 +02007
8#include <stddef.h>
9#include <stdint.h>
Manoj Guptafc4482c2019-09-20 13:43:02 -070010#include <fuzzer/FuzzedDataProvider.h>
Lutz Justen70496c12019-07-24 11:11:55 +020011
12#include "base/logging.h"
Lutz Justen70496c12019-07-24 11:11:55 +020013
14struct Environment {
hschame6711302020-11-20 17:08:14 +090015 Environment() { logging::SetMinLogLevel(logging::LOGGING_FATAL); }
Lutz Justen70496c12019-07-24 11:11:55 +020016};
17
18extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
19 static Environment env;
20 const std::string krb5conf(reinterpret_cast<const char*>(data), size);
21
Felipe Andradea0cbde72020-04-01 15:40:10 +020022 // Note: Krb5InterfaceImpl owns and calls a ConfigParser, but it also runs
Lutz Justen70496c12019-07-24 11:11:55 +020023 // the MIT krb5 parsing code, so we use that.
24 kerberos::Krb5InterfaceImpl krb5;
25
26 kerberos::ConfigErrorInfo error_info;
27 krb5.ValidateConfig(krb5conf, &error_info);
28
29 return 0;
30}