xref: /aosp_15_r20/external/cronet/net/cert/decode_signed_certificate_timestamp_fuzzer.cc (revision 6777b5387eb2ff775bb5750e3f5d96f37fb7352b)
1 // Copyright 2019 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 <stddef.h>
6 #include <stdint.h>
7 
8 #include <string_view>
9 
10 #include "base/memory/scoped_refptr.h"
11 #include "net/cert/ct_serialization.h"
12 #include "net/cert/signed_certificate_timestamp.h"
13 
14 using net::ct::DecodeSignedCertificateTimestamp;
15 using net::ct::SignedCertificateTimestamp;
16 
LLVMFuzzerTestOneInput(const uint8_t * data,size_t size)17 extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
18   scoped_refptr<SignedCertificateTimestamp> sct;
19   std::string_view buffer(reinterpret_cast<const char*>(data), size);
20   DecodeSignedCertificateTimestamp(&buffer, &sct);
21   return 0;
22 }
23