SDDS ToolKit Programs and Libraries for C and Python
Loading...
Searching...
No Matches
fuzz_sdds3.cc File Reference

Detailed Description

In-process fuzz harness for the standalone C++ SDDS parser and decoders.

Exercises layout parsing and page decoding from caller-owned memory with conservative resource limits.

License
This file is distributed under the terms of the Software License Agreement found in the file LICENSE included with this distribution.

Definition in file fuzz_sdds3.cc.

#include "SDDS.hpp"
#include <cstddef>
#include <cstdint>

Go to the source code of this file.

Functions

int LLVMFuzzerTestOneInput (const std::uint8_t *data, std::size_t size)
 

Function Documentation

◆ LLVMFuzzerTestOneInput()

int LLVMFuzzerTestOneInput ( const std::uint8_t * data,
std::size_t size )

Definition at line 28 of file fuzz_sdds3.cc.

28 {
29 sdds::ReaderOptions options;
30 options.recovery = sdds::RecoveryMode::Strict;
31 options.compression = sdds::Compression::None;
32 options.limits.maxRows = 10000;
33 options.limits.maxElements = 100000;
34 options.limits.maxStringBytes = 65536;
35 options.limits.maxLayoutCommandBytes = 65536;
36 options.limits.maxDecompressedBytes = 1024U * 1024U;
37 options.limits.maxIncludeDepth = 0;
38 options.limits.maxPageIndexEntries = 1024;
39 try {
40 auto reader = sdds::Reader::fromSource(sdds::inputFromMemory(data, size),
41 "fuzz-input", options);
42 sdds::ReadRequest request;
43 request.rows.stride = 3;
44 while (reader.next(request)) {}
45 reader.close();
46 } catch (const sdds::Error &) {
47 } catch (const std::exception &) {
48 }
49 return 0;
50}