Coverage Report

Created: 2026-01-18 06:07

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/botan/src/fuzzer/x509_dn.cpp
Line
Count
Source
1
/*
2
* (C) 2019 Jack Lloyd
3
*
4
* Botan is released under the Simplified BSD License (see license.txt)
5
*/
6
7
#include "fuzzers.h"
8
9
#include <botan/ber_dec.h>
10
#include <botan/pkix_types.h>
11
12
2.35k
void fuzz(std::span<const uint8_t> in) {
13
2.35k
   Botan::X509_DN dn1;
14
2.35k
   Botan::X509_DN dn2;
15
16
2.35k
   try {
17
2.35k
      Botan::BER_Decoder ber(in);
18
2.35k
      dn1.decode_from(ber);
19
2.35k
      dn2.decode_from(ber);
20
2.35k
   } catch(...) {
21
1.64k
      return;
22
1.64k
   }
23
24
714
   const bool eq = dn1 == dn2;
25
714
   const bool lt1 = dn1 < dn2;
26
714
   const bool lt2 = dn2 < dn1;
27
28
714
   if(lt1 == false && lt2 == false) {
29
74
      FUZZER_ASSERT_TRUE(eq);
30
640
   } else {
31
      // one is less than the other
32
640
      FUZZER_ASSERT_TRUE(lt1 || lt2);
33
34
      // it is not the case that both are less than the other
35
640
      FUZZER_ASSERT_TRUE(!lt1 || !lt2);
36
640
   }
37
714
}