blob: e27675b3cd12a6f0bbbc8887d104a8c1e22bd334 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
#include <cstddef>
#include <cstdint>
#include <cstdio>
#include "wireframe/pcapng/reader.hpp"
// Reader parses file/network data that isn't necessarily our own
// writer's output - a user could point it at any file. fmemopen()
// gives libFuzzer's byte buffer a FILE* without touching a real file.
extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
FILE* file = fmemopen(const_cast<uint8_t*>(data), size, "rb");
if (file == nullptr) return 0;
wireframe::pcapng::Reader reader(file);
while (reader.next_packet()) {
// keep draining until EOF/malformed-block termination
}
std::fclose(file);
return 0;
}
|