diff options
Diffstat (limited to 'fuzz/decode_frame.cc')
-rw-r--r-- | fuzz/decode_frame.cc | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/fuzz/decode_frame.cc b/fuzz/decode_frame.cc new file mode 100644 index 0000000..13431fd --- /dev/null +++ b/fuzz/decode_frame.cc @@ -0,0 +1,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; +} |