Coverage Report

Created: 2025-08-18 06:36

/src/nss/fuzz/targets/smime.cc
Line
Count
Source (jump to first uncovered line)
1
/* This Source Code Form is subject to the terms of the Mozilla Public
2
 * License, v. 2.0. If a copy of the MPL was not distributed with this
3
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
4
5
#include <cstddef>
6
#include <cstdint>
7
8
#include "scoped_ptrs_smime.h"
9
#include "smime.h"
10
11
#include "asn1/mutators.h"
12
#include "base/database.h"
13
#include "base/mutate.h"
14
15
4.27k
extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
16
4.27k
  static NSSDatabase db = NSSDatabase();
17
18
4.27k
  SECItem buffer = {siBuffer, (unsigned char *)data, (unsigned int)size};
19
20
4.27k
  ScopedNSSCMSMessage cmsg(NSS_CMSMessage_CreateFromDER(
21
4.27k
      &buffer, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr));
22
4.27k
  (void)NSS_CMSMessage_IsSigned(cmsg.get());
23
24
4.27k
  return 0;
25
4.27k
}
26
27
extern "C" size_t LLVMFuzzerCustomMutator(uint8_t *data, size_t size,
28
0
                                          size_t maxSize, unsigned int seed) {
29
0
  return CustomMutate(
30
0
      Mutators({ASN1Mutators::FlipConstructed, ASN1Mutators::ChangeType}), data,
31
0
      size, maxSize, seed);
32
0
}