summaryrefslogtreecommitdiffstats
path: root/fuzz/decode_frame.cc
blob: 13431fdbd46365079c2798e7bdce29fcd1af351b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#ifdef __cplusplus
extern "C" {
#endif

#include "ngtcp2_conn.h"

#ifdef __cplusplus
}
#endif

extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
  for (; size;) {
    ngtcp2_max_frame mfr{};

    auto nread = ngtcp2_pkt_decode_frame(&mfr.fr, data, size);
    if (nread < 0) {
      return 0;
    }

    data += nread;
    size -= nread;
  }

  return 0;
}