xref: /aosp_15_r20/external/cronet/net/third_party/quiche/src/quiche/quic/core/crypto/certificate_view_der_fuzzer.cc (revision 6777b5387eb2ff775bb5750e3f5d96f37fb7352b)
1 // Copyright 2020 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 "quiche/quic/core/crypto/certificate_view.h"
8 
LLVMFuzzerTestOneInput(const uint8_t * data,size_t size)9 extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
10   std::string input(reinterpret_cast<const char*>(data), size);
11 
12   std::unique_ptr<quic::CertificateView> view =
13       quic::CertificateView::ParseSingleCertificate(input);
14   if (view != nullptr) {
15     view->GetHumanReadableSubject();
16   }
17   quic::CertificatePrivateKey::LoadFromDer(input);
18   return 0;
19 }
20