Sonde v1.1.0
Embeddable Model Context Protocol server for Qt applications
Loading...
Searching...
No Matches
fuzz_jsonrpc.cpp File Reference

Fuzzes JSON-RPC dispatch (ServerPrivate::handleMessage) with arbitrary message lines, as a client would send them over the local socket. More...

#include "server_p.h"
#include <sonde/eventsource.h>
#include <sonde/introspectiontools.h>
#include <QtCore/QCoreApplication>
#include <QtCore/QJsonArray>
#include <QtCore/QJsonDocument>
#include <array>
#include <cstdint>
#include <cstdlib>
#include <memory>

Classes

struct  anonymous_namespace{fuzz_jsonrpc.cpp}::Fixture
 The application, server and event source shared by all inputs. More...

Functions

Fixture & anonymous_namespace{fuzz_jsonrpc.cpp}::fixture ()
 The fixture, created on first use.
void anonymous_namespace{fuzz_jsonrpc.cpp}::require (bool condition)
 Aborts (so libFuzzer reports the input) if condition is false.
void anonymous_namespace{fuzz_jsonrpc.cpp}::dispatch (Sonde::ServerPrivate *d, const Sonde::SessionPtr &session, const QJsonObject &message)
 Dispatches one message, checking that a request is answered at most once.
int LLVMFuzzerTestOneInput (const uint8_t *data, size_t size)
 libFuzzer entry point: each line of data is one JSON-RPC message or batch.

Detailed Description

Fuzzes JSON-RPC dispatch (ServerPrivate::handleMessage) with arbitrary message lines, as a client would send them over the local socket.