1 // Copyright 2016 The Chromium Authors 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 "net/cert/pki/verify_name_match.h" 6 7 #include "net/cert/pki/cert_errors.h" 8 #include "net/der/input.h" 9 10 // Entry point for LibFuzzer. LLVMFuzzerTestOneInput(const uint8_t * data,size_t size)11extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { 12 net::der::Input in(data, size); 13 std::string normalized_der; 14 net::CertErrors errors; 15 bool success = net::NormalizeName(in, &normalized_der, &errors); 16 if (success) { 17 // If the input was successfully normalized, re-normalizing it should 18 // produce the same output again. 19 std::string renormalized_der; 20 bool renormalize_success = net::NormalizeName( 21 net::der::Input(&normalized_der), &renormalized_der, &errors); 22 CHECK(renormalize_success); 23 CHECK_EQ(normalized_der, renormalized_der); 24 } 25 return 0; 26 } 27